CURL設(shè)置超時
- curl普通秒級超時:
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,$url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT,60); //只需要設(shè)置一個秒的數(shù)量就可以
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
curl_setopt($ch, CURLOPT_USERAGENT, $defined_vars['HTTP_USER_AGENT']);
- curl普通秒級超時使用:
復(fù)制代碼代碼如下:
curl_setopt($ch, CURLOPT_TIMEOUT,60);
- curl如果需要進(jìn)行毫秒超時磁餐,需要增加:
復(fù)制代碼代碼如下:
curl_easy_setopt(curl, CURLOPT_NOSIGNAL,1L); //或者
curl_setopt ( $ch, CURLOPT_NOSIGNAL,true);//支持毫秒級別超時設(shè)置
explore 和implore
兩個不錯的函數(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;
}