-3

为什么我在使用时收到此错误substr

警告:substr() 期望参数 2 很长`

$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>"); 
4

1 回答 1

0

参考: http: //php.net/manual/en/function.substr.php

substr 的语法:string substr ( string $string , int $start [, int $length ] )

echo substr($webdata, 0, 5);应该是这样的。

于 2013-03-01T06:34:05.340 回答