作者johnps (皮卡~)
站內PHP
標題[請益] preg_match_all抓不到資料
時間Mon Oct 11 22:11:56 2010
我想要抓
http://0rz.tw/QsPhN的新聞
用
preg_match_all('/class=\"news_title\">(.+?)<\/span>/',$content,$newsti);
有抓到標題
可是
preg_match_all('/<div id=\"newsc\" class=\"news_content\">(.+?)<\/div>/'......
卻一直抓不到新聞內容
從原始檔怎麼看都是包在
<div id="newsc" class="news_content">
</div>
中間...
print_r出來都是空的
請問我這樣寫問題是在哪呢?
謝謝<(_ _)>
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 134.208.38.182
1F:推 knuckles:.不含換行 改用'/<div>(.+?)<\/div>/s' 10/11 22:51
2F:推 ideaup:(.+?)>(.*) 10/12 06:40
4F:→ foxzgerald:確定一下你設定的正規表示式能選到你想要的內容 10/12 22:38