Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我刚刚发现它已eregi被弃用,并且preg replace工作方式不同。你会怎么翻译这个?
eregi
preg replace
$text = eregi_replace("\\[img\\]([^\\[]*)\\[/img\\]", "", $text);
显然这有效:
$text = preg_replace("#\[img\](.+?)\[/img\]#is", "", $text);
你可以试试这个
$text = preg_replace("/\\[img\\]([^\\[]*)\\[/img\\]/i", "", $text);
/
/i
preg_replace
eregi_replace