久久久久久久视色,久久电影免费精品,中文亚洲欧美乱码在线观看,在线免费播放AV片

<center id="vfaef"><input id="vfaef"><table id="vfaef"></table></input></center>

    <p id="vfaef"><kbd id="vfaef"></kbd></p>

    
    
    <pre id="vfaef"><u id="vfaef"></u></pre>

      <thead id="vfaef"><input id="vfaef"></input></thead>

    1. 站長資訊網(wǎng)
      最全最豐富的資訊網(wǎng)站

      分享PHP函數(shù)使用小工具(附代碼示例)

      本篇文章給大家?guī)砹岁P(guān)于PHP的相關(guān)知識,其中主要介紹了PHP怎么檢測IP相關(guān)信息的,以及PHP如何獲取HTTP、vue包等,感興趣的朋友,下面一起來看一下吧,希望對大家有幫助。

      分享PHP函數(shù)使用小工具(附代碼示例)

      • PHP檢測IP是否內(nèi)網(wǎng)地址、保留地址

      /**  * @param string $ip 被檢測的IP  * @return bool 是否內(nèi)網(wǎng)或者保留IP  */ public function isInternalIp($ip) {     $ip = ip2long($ip);     if (!$ip) {         //非法IP,直接算true吧         return true;     }     $net_a = ip2long('10.255.255.255') >> 24; //A類網(wǎng)預(yù)留ip的網(wǎng)絡(luò)地     $net_b = ip2long('172.31.255.255') >> 20; //B類網(wǎng)預(yù)留ip的網(wǎng)絡(luò)地址     $net_c = ip2long('192.168.255.255') >> 16; //C類網(wǎng)預(yù)留ip的網(wǎng)絡(luò)地址     $net_local127 = ip2long('127.255.255.255') >> 24; //127保留地址     $net_local169 = ip2long('169.254.255.255') >> 16; //169保留地址     return $ip >> 24 === $net_a || $ip >> 20 === $net_b || $ip >> 16 === $net_c || $net_local127 === $ip >> 24 || $net_local169 === $ip >> 16; }
      登錄后復(fù)制

      這個是我網(wǎng)上找來的,具體地址我忘了,然后自己加了保留地址的檢測

      • PHP獲取HTTP包流量整個HTTP請求包流量

          public function http()     {         $row = $_SERVER['REQUEST_URI'] . "rr";         $header = getallheaders();         foreach ($header as $k => $v) {             $row .= $k . ': ' . $v . "r";         }         $row .= "rr" . file_get_contents("php://input");         return $row;     }
      登錄后復(fù)制

      • vue差量更新包-PHP處理

      public function test() {     $config = json_decode(file_get_contents('vueconfig.json'), true); //配置目錄,初次使用要先建立配置     $path = 'D:\web\project\vue\dist\static\'; // 打包的靜態(tài)地址     foreach ($config as  $dir => $type) {         foreach (scandir($path . $dir) as $fkey => $fva) {             if ($fva == '.' || $fva == '..') {                 continue;             } else {                 if (in_array($fva, $type)) {                     //沒有更新就刪除該文件                     unlink($path . $dir . '\' . $fva);                 } else {                     echo '新增文件:' . $path . $dir . '\' . $fva . "<br>";                     //有更新就把新文件加入到配置表里記錄                     $config[$dir][$fkey] = $fva;                 }             }         }     }     //更新配置表     file_put_contents('vueconfig.json', json_encode($config)); }
      登錄后復(fù)制

      直接運(yùn)行即可刪除沒有改變的文件,保留更新的文件,實(shí)現(xiàn)差量更新

      推薦學(xué)習(xí):《PHP視頻教程》

      贊(0)
      分享到: 更多 (0)
      網(wǎng)站地圖   滬ICP備18035694號-2    滬公網(wǎng)安備31011702889846號