【发布时间】:2018-08-25 20:11:25
【问题描述】:
我正在尝试从 url 获取某个表格的内容,但它总是得到一个字符串。
我想知道是否可以使用 foreach 循环来获取表中的所有字符串,例如:
<?php
$url = 'https://www.w3.org/WAI/UA/2002/06/thead-test';
$content = file_get_contents($url);
$first_step = explode( '<td>' , $content );
$second_step = explode('</td>' , $first_step[1] );
$output = $second_step[0];
echo $output;
?>
经过一番研究,我找到了一些链接,但对我没有太大帮助。
任何帮助表示赞赏:)
【问题讨论】:
标签: php url foreach file-get-contents