看板 PHP 關於我們 聯絡資訊
我想要抓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
knuckles:.不含換行 改用'/<div>(.+?)<\/div>/s' 10/11 22:51
ideaup:(.+?)>(.*) 10/12 06:40
foxzgerald:http://www.weitz.de/regex-coach/ 拿來測一下火星文 10/12 22:37
foxzgerald:確定一下你設定的正規表示式能選到你想要的內容 10/12 22:38