PHP获取HTML标签解决方法

WBOY
풀어 주다: 2016-06-13 11:49:00
원래의
1098명이 탐색했습니다.

PHP获取HTML标签

<html><br /><body><br /><tr id="ASPxGridView1_DXDataRow0" class="dxgvDataRow_Soft_Orange"><br />	<td class="dxgv">53</td><br />		<td class="dxgv"><a class="dxeHyperlink" href="onest.aspx?stnm=外海&startm=&endtm=" target="_blank">1</a></td><br />		<td class="dxgv">2</td><br />		<td class="dxgv">3</td><br />		<td class="dxgv">4</td><br />		<td class="dxgv">6</td><br />		<td class="dxgv">7</td><br />		<td class="dxgv">8</td><br />		<td class="dxgv">9</td><br />		<td class="dxgv" style="border-right-width:0px;">10</td><br />	</tr><br />	<tr id="ASPxGridView1_DXDataRow1" class="dxgvDataRow_Soft_Orange"><br />		<td class="dxgv">11</td><br />		<td class="dxgv"><a class="dxeHyperlink" href="onest.aspx?stnm=j江苏&startm=&endtm=" target="_blank">12</a></td><br />		<td class="dxgv">13</td><br />		<td class="dxgv">14</td><br />		<td class="dxgv">15</td><br />		<td class="dxgv">16</td><br />		<td class="dxgv">17</td><br />		<td class="dxgv">18</td><br />		<td class="dxgv">19</td><br />		<td class="dxgv" style="border-right-width:0px;">20</td><br />	</tr><br />	<tr id="ASPxGridView1_DXDataRow1" class="dxgvDataRow_Soft_Orange"><br />		<td class="dxgv">21</td><br />		<td class="dxgv"><a class="dxeHyperlink" href="onest.aspx?stnm=上海&startm=&endtm=" target="_blank">22</a></td><br />		<td class="dxgv">23</td><br />		<td class="dxgv">24</td><br />		<td class="dxgv">25</td><br />		<td class="dxgv">26</td><br />		<td class="dxgv">27</td><br />		<td class="dxgv">28</td><br />		<td class="dxgv">29</td><br />		<td class="dxgv" style="border-right-width:0px;">30</td><br />	</tr><br /></tr><br /></body><br /></html>	
로그인 후 복사


请教如何获得标签中的1~30这些值呢?最好用simple_html_dom来获取?知道的朋友说下哦!如果不是用这个类也可以!
------解决方案--------------------
 $s=<<<html><br /><body><br /><tr id="ASPxGridView1_DXDataRow0" class="dxgvDataRow_Soft_Orange"><br />	<td class="dxgv">53</td><br />		<td class="dxgv"><a class="dxeHyperlink" href="onest.aspx?stnm=外海&startm=&endtm=" target="_blank">1</a></td><br />		<td class="dxgv">2</td><br />		<td class="dxgv">3</td><br />		<td class="dxgv">4</td><br />		<td class="dxgv">6</td><br />		<td class="dxgv">7</td><br />		<td class="dxgv">8</td><br />		<td class="dxgv">9</td><br />		<td class="dxgv" style="border-right-width:0px;">10</td><br />	</tr><br />	<tr id="ASPxGridView1_DXDataRow1" class="dxgvDataRow_Soft_Orange"><br />		<td class="dxgv">11</td><br />		<td class="dxgv"><a class="dxeHyperlink" href="onest.aspx?stnm=j江苏&startm=&endtm=" target="_blank">12</a></td><br />		<td class="dxgv">13</td><br />		<td class="dxgv">14</td><br />		<td class="dxgv">15</td><br />		<td class="dxgv">16</td><br />		<td class="dxgv">17</td><br />		<td class="dxgv">18</td><br />		<td class="dxgv">19</td><br />		<td class="dxgv" style="border-right-width:0px;">20</td><br />	</tr><br />	<tr id="ASPxGridView1_DXDataRow1" class="dxgvDataRow_Soft_Orange"><br />		<td class="dxgv">21</td><br />		<td class="dxgv"><a class="dxeHyperlink" href="onest.aspx?stnm=上海&startm=&endtm=" target="_blank">22</a></td><br />		<td class="dxgv">23</td><br />		<td class="dxgv">24</td><br />		<td class="dxgv">25</td><br />		<td class="dxgv">26</td><br />		<td class="dxgv">27</td><br />		<td class="dxgv">28</td><br />		<td class="dxgv">29</td><br />		<td class="dxgv" style="border-right-width:0px;">30</td><br />	</tr><br /></tr><br /></body><br /></html>	
txt;
preg_match_all("#>(\d+)()?#isU",$s,$m);
print_r($m[1]);
로그인 후 복사

------解决方案--------------------

<?php <br /><br>	$html = <br><br><tr>
<br>	<td>53</td>
<br>		<td><a>1</a></td>
<br>		<td>2</td>
<br>		<td>3</td>
<br>		<td>4</td>
<br>		<td>6</td>
<br>		<td>7</td>
<br>		<td>8</td>
<br>		<td>9</td>
<br>		<td>10</td>
<br>	</tr><br>	<tr><div class="clear">
                 
              
              
        
            </div></tr>
로그인 후 복사
관련 라벨:
원천:php.cn
본 웹사이트의 성명
본 글의 내용은 네티즌들의 자발적인 기여로 작성되었으며, 저작권은 원저작자에게 있습니다. 본 사이트는 이에 상응하는 법적 책임을 지지 않습니다. 표절이나 침해가 의심되는 콘텐츠를 발견한 경우 admin@php.cn으로 문의하세요.
인기 튜토리얼
더>
최신 다운로드
더>
웹 효과
웹사이트 소스 코드
웹사이트 자료
프론트엔드 템플릿