Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/231.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 $matches[0]未在屏幕上显示数据,但表示数据在屏幕上? $str=“_Php_Regex_Preg Match_Preg Match All - Fatal编程技术网

Php $matches[0]未在屏幕上显示数据,但表示数据在屏幕上? $str=“

Php $matches[0]未在屏幕上显示数据,但表示数据在屏幕上? $str=“,php,regex,preg-match,preg-match-all,Php,Regex,Preg Match,Preg Match All,”; preg_match_all(“/]>/”,$str,$matches); My$matches[0]表示有数据(字符串长度43),但屏幕上没有字符串输出 数组(1){[0]=>string(43)“} 如果我删除,您将无法在屏幕上获取数据,可能是因为浏览器试图呈现未知的html/xml标记: 使用您的代码,我在$matches上得到以下结果: $str = "<p><example:wow id='test' style='hello' /></p>

”; preg_match_all(“/]>/”,$str,$matches); My$matches[0]表示有数据(字符串长度43),但屏幕上没有字符串输出

数组(1){[0]=>string(43)“}


如果我删除
,您将无法在屏幕上获取数据,可能是因为浏览器试图呈现未知的html/xml标记:

使用您的代码,我在$matches上得到以下结果:

$str = "<p><example:wow id='test' style='hello' /></p>";

preg_match_all ("/<example:wow(.*)[^>]>/", $str, $matches);

您可能会将其输出到尖括号有意义的地方,例如网页,浏览器通常将其解释为html。然后使用查看源代码。@mario-谢谢你correct@user983223:作为一个旁白问题,您需要提取什么?
Array
(
    [0] => Array
        (
            [0] => <example:wow id='test' style='hello' /></p>
        )

    [1] => Array
        (
            [0] =>  id='test' style='hello' /></
        )

)
print_r ($matches);