PHP配置前端接口文件

71 阅读2分钟
开启掘金成长之旅!这是我参与「掘金日新计划 · 12 月更文挑战」的第4天,点击查看活动详情

第一篇HTML中已经普及完了常用的基础标签,可点击查看juejin.cn/post/716831…

第二篇,我们就了解下,常用标签的语法

HTML——HTML标签及列表解析 ② - 掘金 (juejin.cn)

第三篇,我们就来了解下,HTML5阶段新增的标签

HTML——HTML5阶段新增的标签③ - 掘金 (juejin.cn)

起源于
文章的技术起源于 领导分配了一个新的开发项目,跟新同事PHP后端工程师配合,开发新的页面(是不是很简单?跟后端(阿亮)沟通时,让我感觉到 我遇到了(沟通的)难题)
佛手抬起
经过一周的紧追不舍,缠着后端出活 终于 在周五下午 我看到了所谓的接口文件;内容出乎我的意料(如此的简单)
前端需求: 点击跳转新的HTML文件,配置语言PHP,前端语言:js原生开发
首先 阿亮找到了 column_cn.php文件,PHP工程师们应该无比的熟悉,代码如下
image.png
20 => 
  array (
    'id' => '769',
    'name' => '我叫什么',
    'foldername' => 'bulfz.php',  //跳转到配置文件
    'filename' => '',
    'bigclass' => '0',
    'samefile' => '0',
    'module' => '5',
    'no_order' => '9',
    'wap_ok' => '0',
    'wap_nav_ok' => '0',
    'if_in' => '0',
    'nav' => '3',
    'ctitle' => '',
    'keywords' => '',
    'content' => '',
    'description' => '',
    'list_order' => '1',
    'new_windows' => '1',
    'classtype' => '1',
    'out_url' => '',
    'index_num' => '1',
    'access' => '0',
    'indeximg' => '',
    'columnimg' => '',
    'isshow' => '1',
    'lang' => 'cn',
    'namemark' => '',
    'releclass' => '0',
    'display' => '0',
    'icon' => '',
    'nofollow' => '0',
    'other_info' => '',
    'custom_info' => '',
    'text_size' => '0',
    'text_color' => '',
    'thumb_list' => '1000|1000',
    'thumb_detail' => '|',
    'list_length' => '0',
    'tab_num' => '0',
    'tab_name' => '||||',
  ),
其次 创建bulfz.php文件,代码如下
image.png

<?php 
$agent = strtolower($_SERVER['HTTP_USER_AGENT']);
        $is_pc = (strpos($agent, 'windows nt')) ? true : false;
        $is_mac = (strpos($agent, 'mac os')) ? true : false;
        $is_iphone = (strpos($agent, 'iphone')) ? true : false;
        $is_android = (strpos($agent, 'android')) ? true : false;
        $is_ipad = (strpos($agent, 'ipad')) ? true : false;
        if($is_pc){
            //echo '1';
            $string = file_get_contents("bulfz.html");
            echo  $string;
          return;
              return  false;
        }
        if($is_mac){
             $string = file_get_contents("tribalark.html");
     echo  $string; 
     return;
              return  true;
        }
        if($is_iphone){
             $string = file_get_contents("tribalark.html");
     echo  $string; 
     return;
              return  true;
        }
        if($is_android){
             $string = file_get_contents("tribalark.html");
     echo  $string; 
     return;
              return  true;
        }
        if($is_ipad){
             $string = file_get_contents("tribalark.html");
     echo  $string; 
     return;
              return  true;
        }
die;

if (isset ($_SERVER['HTTP_X_WAP_PROFILE'])){
  
$string = file_get_contents("bulfz.html");
          echo  $string;
          return;

}else{
   $string = file_get_contents("tribalark.html");
     echo  $string; 
     return;
}
return $string;

最后 配置成功 跳转到前端HTML页面
佛手止 你们觉得 这个工作量需要五天吗???

惊呆了老铁

放出来 希望能帮助到精英们