为什么我在使用substr
时收到此错误:
警告:substr()期望参数2为long`
$url = "http://coast.x-matic.net/forums/categories/pso-news";
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
$webdata = (string) curl_exec($ch);
curl_close($ch);
echo substr($webdata, "<a * class=\"title\">*</a>");
答案 0 :(得分:0)
参考:http://php.net/manual/en/function.substr.php
substr:string substr ( string $string , int $start [, int $length ] )
echo substr($webdata, 0, 5);
应该是这样的。