2013-03-01 87 views
-3

爲什麼會出現這個錯誤,而使用substr警告:SUBSTR()預計參數2到長

警告: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>"); 
+2

這不是substr的正確使用,也許你想在這裏使用任何其他功能。對於第二個選項,你應該給它一個長度而不是一個字符串。見http://php.net/substr – 2013-03-01 06:34:16

+0

我認爲你應該使用strstr()。 – cartina 2013-03-01 06:42:32

回答

相關問題