simple html dom returning string instead of array

僤鯓⒐⒋嵵緔 提交于 2019-12-13 17:27:32

问题


I have the following code

$html3->find('TR[d=lt]',0);

for the following source code

<TR>
<TH NOWRAP ALIGN=RIGHT VALIGN=TOP> Date:</TH>
<TD d="lt">
  2011-05-31 </TD>
</TR>
<TR>
<TH NOWRAP ALIGN=RIGHT VALIGN=TOP>Title:</TH>
<TD d="lt">
  NETWORKS</TD>
</TR>
<TR>
<TH NOWRAP ALIGN=RIGHT VALIGN=TOP>Title:</TH>
<TD d="lt">
 Low NETWORKS</TD>
</TR>
<TR>
<TH NOWRAP ALIGN=RIGHT VALIGN=TOP>Description:</TH>
<TD d="lt">
 CD</TD>
</TR>

however the code only returns as an string the DATE instead of the an array of all the vaules,


回答1:


wow that's pretty sparse on your question code.

However, take a look here:

http://simplehtmldom.sourceforge.net/manual.htm#section_find

You will find that passing in the int as the second arg tells the function you are looking for a specific element. Get rid of the second arg and you should get an array of all results back.



来源:https://stackoverflow.com/questions/16430802/simple-html-dom-returning-string-instead-of-array

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!