0

我将如何改变

$output = ereg_replace("<script.*</script>", "", $output);

怀孕?

 I tried $output = preg_replace("/<script.*</script>/", "", $output);

谢谢

编辑:对不起,格式混乱

4

1 回答 1

2

如果您/用作分隔符,则必须转义/模式中的每一次出现,否则将其识别为分隔符本身,并且后面的所有内容都将用作修饰符(这可能会失败)。

"/<script.*<\/script>/"

或者你让你的生活变得轻松,只需选择一个不同的分隔符。我更喜欢~,因为它很少出现在模式中

"~<script.*</script>~"

更新:查看说明的评论,这里发生了什么

"~<script.*</script>~siU"
于 2011-05-04T19:49:16.320 回答