Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/258.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 什么';这场预赛怎么了_Php_Preg Match_Preg Match All - Fatal编程技术网

Php 什么';这场预赛怎么了

Php 什么';这场预赛怎么了,php,preg-match,preg-match-all,Php,Preg Match,Preg Match All,我正在使用file\u get\u contents读取一个包含表格的.html文件 <table id="someTable" style="width:100%;margin-bottom:0;"> <tr style="display:none;"> <td style="padding-left:25px;">Some text</td> </tr> <tr style="displ

我正在使用
file\u get\u contents
读取一个包含表格的
.html
文件

<table id="someTable" style="width:100%;margin-bottom:0;">
    <tr style="display:none;">
        <td style="padding-left:25px;">Some text</td>
    </tr>
    <tr style="display:none;">
        <td style="padding-left:25px;">another text</td>
    </tr>
</table>

将修饰符
s
添加到预匹配中

preg_match_all('/<table id="someTable" style="width:100%;margin-bottom:0;">(.*)<\/table>/s', $html, $matches);
preg_match_all('/(.*)/s',$html,$matches);

请参见

使用正则表达式解析HTML几乎肯定不是一条可行之路。你希望实现什么目标?
preg_match_all('/<table id="someTable" style="width:100%;margin-bottom:0;">(.*)<\/table>/s', $html, $matches);