不建议使用ereg_replace()函数-如何清除此错误? [英] Function ereg_replace() is deprecated - How to clear this bug?
本文介绍了不建议使用ereg_replace()函数-如何清除此错误?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我编写了以下PHP代码:
I have written following PHP code:
$input="menu=1&type=0&";
print $input."<hr>".ereg_replace('/&/', ':::', $input);
运行上述代码后,它会发出以下警告,
After running above code, it gives following warning,
已弃用:函数ereg_replace()已弃用
Deprecated: Function ereg_replace() is deprecated
如何解决此警告.
推荐答案
切换到 preg_replace
Docs 并更新表达式以使用preg语法(PCRE)而不是ereg语法(POSIX) ereg_replace
文档 ).
Switch to preg_replace
Docs and update the expression to use preg syntax (PCRE) instead of ereg syntax (POSIX) where there are differencesDocs (just as it says to do in the manual for ereg_replace
Docs).
这篇关于不建议使用ereg_replace()函数-如何清除此错误?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文