我有以下错误:
警告:preg_replace():第38行的xxx.php中的未知修饰符']'
这是第38行的代码:
<?php echo str_replace("</ul></div>", "", preg_replace("<div[^>]*><ul[^>]*>", "", wp_nav_menu(array('theme_location' => 'nav', 'echo' => false)) )); ?>
Run Code Online (Sandbox Code Playgroud)
有人可以帮我解决这个问题吗?
假设$ body等于
something
that
does
not
interest
me
<!-- start -->
some
html
code
<!-- end -->
something
that
does
not
interest
me
Run Code Online (Sandbox Code Playgroud)
如果我使用
$body=preg_replace("(.*)<!-- start -->(.*)<!-- end -->(.*)","$2",$body);
Run Code Online (Sandbox Code Playgroud)
我获得:
something
that
does
not
interest
me
<!-- start -->
some
html
code
<!-- end -->
something
that
does
not
interest
me
Run Code Online (Sandbox Code Playgroud)
我该如何纠正?