preg_replace() [function.preg-replace]: Unknown modifier '/' in /home/

前端 未结 2 1895
逝去的感伤
逝去的感伤 2021-01-28 16:10

in my website i want to replace links with some other link like this

www.abc.com or http://abc.com will be replaced with

http:/

2条回答
  •  深忆病人
    2021-01-28 16:24

    "/\[url]www|http://.([^'\"]*)\[\/url]/iU",
     ^               ^^                  ^
    

    You either need to escape the two // in the middle to \/\/, or, better, use different delimiters for the regex:

    "~\[url]www|http://.([^'\"]*)\[/url]~iU",
    

提交回复
热议问题