PHP小結(jié)大全

CURL設(shè)置超時(shí)

  1. curl普通秒級(jí)超時(shí):
$ch = curl_init();       
curl_setopt($ch, CURLOPT_URL,$url);     
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);        
curl_setopt($ch, CURLOPT_TIMEOUT,60);   //只需要設(shè)置一個(gè)秒的數(shù)量就可以   
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);        
curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']);
  1. curl普通秒級(jí)超時(shí)使用:
    復(fù)制代碼代碼如下:
curl_setopt($ch, CURLOPT_TIMEOUT,60);
  1. curl如果需要進(jìn)行毫秒超時(shí),需要增加:
    復(fù)制代碼代碼如下:
curl_easy_setopt(curl, CURLOPT_NOSIGNAL,1L);       //或者       
curl_setopt ( $ch,  CURLOPT_NOSIGNAL,true);//支持毫秒級(jí)別超時(shí)設(shè)置

explore 和implore

兩個(gè)不錯(cuò)的函數(shù),字符串拆分和合并

sql注入解析

 function filterWords(&$str)
    {
        $farr = array(
            "/<(\\/?)(script|i?frame|style|html|body|title|link|meta|object|\\?|\\%)([^>]*?)>/isU",
            "/(<[^>]*)on[a-zA-Z]+\s*=([^>]*>)/isU",
            "/select\b|insert\b|update\b|delete\b|drop\b|;|\"|\'|\/\*|\*|\.\.\/|\.\/|union|into|load_file|outfile|dump/is"
        );
        $str = preg_replace($farr,'',$str);
        $str = strip_tags($str);
        return $str;
    }
最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書(shū)系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容