![](/img/trans.png)
[英]preg_match(): Compilation failed: nothing to repeat at offset 1 in laravel
[英]preg_match_all(): Compilation failed: nothing to repeat at offset 203 runescape
有人可以告訴我為什么這行不通嗎?
我收到錯誤信息“ preg_match_all():編譯失敗:在偏移量203處沒有重復的內容”
$html = file_get_contents('http://services.runescape.com/m=itemdb_rs/results.ws?query='.urlencode($term).'&price='.$pricerange.'&members='.$members);
$html = str_replace(array("\r","\n"), "", $html);
$regexp = '#<tr data-item-id="(.*?)"><td class="(.*?)"><img src="(.*?)" alt="(.*?)"><a href="(.*?)">(.*?)</a></td><td><img src="(.*?)" alt="(.*?)" title="(.*?)"></td><td class="(.*?)">(.*?)</td><td class="(.*?)">(.?*)</td></tr>#';
preg_match_all($regexp, $html, $matches);
print_r($matches);
將在file_get_contents中使用的示例URL
http://services.runescape.com/m=itemdb_rs/results.ws?query=gold%20bar&price=all&members=no
謝謝 :)
我建議您的錯誤就在這里:
<td class="(.*?)">(.?*)</td></tr>#
替換為
<td class="(.*?)">(.*?)</td></tr>#
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.