我尝试使用字符串作为正则表达式模式,但出现以下错误
PHP Warning: preg_match(): Unknown modifier '>' in /Applications/MAMP/htdocs/cruncher/Plugins/wordpress/WPDetect.php on line 22
PHP Warning: preg_match(): Unknown modifier '/' in /Applications/MAMP/htdocs/cruncher/Plugins/wordpress/WPDetect.php on line 22
The code
$str = "<meta name=\"generator\" content=\"WordPress.com\" />"
preg_match("/".$str."/", $content->content)
我也尝试使用preg_quote
功能,但我有类似的问题。
使它发挥作用的正确方法是什么?
Sultan
Use preg_quote
功能和图案包含|...|
preg_match("|" . preg_quote($str, "|") . "|", $content->content)
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)