ホームページ >バックエンド開発 >PHPチュートリアル >PHP による HTML タグの取得ソリューション
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>
$html = <<
$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]);