Re: [請益] 請問要怎樣用preg_match_all抓符合二個 …

看板PHP作者 (火鍋)時間16年前 (2009/03/18 21:11), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串5/5 (看更多)
※ 引述《jami520 (我的生命因你而發光)》之銘言: : ※ 引述《arianda (火鍋)》之銘言: : 比如 : <td nowrap class="changedown">123</td> : <td nowrap class="changeup">456</td> : <td nowrap class="changedown">789</td> : 然後存成陣列$string : $string[0]=123 : $string[1]=456 : $string[2]=789 : 這樣該如何表示? 你的例子是這樣子 $strings = '<td nowrap class="changedown">123</td> <td nowrap class="changeup">456</td> <td nowrap class="changedown">789</td>'; phpQuery::newDocument($strings); $i =0; foreach( pq("td") as $v ) $string[$i++] = pq($v)->text(); print_r($string); 但是整個html 不會只有這三個td, 所以寫法就會不一樣了 phpQuery的選擇器(Selector)可以參考jQuery -- 海綿寶寶, 不要講話!派大星! 我覺得有人在盯著我們看... 你會害我們被發現! JUNU -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 59.105.179.106
文章代碼(AID): #19mFBsSj (PHP)
文章代碼(AID): #19mFBsSj (PHP)