Php 未知修饰符';l';错误
它说我的正则表达式有一个未知的修饰符,但我不确定到底是什么触发了这个错误Php 未知修饰符';l';错误,php,regex,Php,Regex,它说我的正则表达式有一个未知的修饰符,但我不确定到底是什么触发了这个错误 Warning: preg_match_all() [function.preg-match-all]: Unknown modifier 'l' in /var/www/test.php on line 9 preg\u match\u all(“/\要求使用分隔模式与可选模式的分隔符来分隔模式。但是,如果这些分隔符出现在模式内部,则需要对其进行转义。因此,您需要转义模式内部的分隔符/: preg_match_all(
Warning: preg_match_all() [function.preg-match-all]: Unknown modifier 'l' in /var/www/test.php on line 9
preg\u match\u all(“/\要求使用分隔模式与可选模式的分隔符来分隔模式。但是,如果这些分隔符出现在模式内部,则需要对其进行转义。因此,您需要转义模式内部的分隔符/
:
preg_match_all("/\<select id\=\'subscription_division_id\'(.+?)</select>\/is", $html, $matches);
“/\您转义错误。对于正则表达式解析器,以下是您的正则表达式:
"/\<select id\=\'subscription_division_id\'(.+?)<\/select>/is"
^
+1使用不同的分隔符(通常是~
)会更好,因此根本不需要转义。
\<select id\=\'subscription_division_id\'(.+?)<
preg_match_all("/<select id='subscription_division_id'(.+?)<\/select>/is", $html, $matches);