Re: [請益] 請問要怎樣用preg_match_all抓符合二個 …
※ 引述《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
討論串 (同標題文章)
本文引述了以下文章的的內容:
完整討論串 (本文為第 5 之 5 篇):
PHP 近期熱門文章
PTT數位生活區 即時熱門文章