我尝试使用字符串作为正则表达式模式但我跟随错误
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
$str = "<Meta name=\"generator\" content=\"wordpress.com\" />" preg_match("/".$str."/",$content->content)
我也试过使用preg_quote函数,但我遇到了类似的问题.
使它运作的正确方法是什么?
苏丹
使用带有| … |的preg_quote函数和模式
preg_match("|" . preg_quote($str,"|") . "|",$content->content)