PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法分析

发布时间:2022-04-30 发布网站:脚本宝典
脚本宝典收集整理的这篇文章主要介绍了PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法分析脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。

本文实例讲述了PHP正则替换函数PReg_replace()报错:Notice Use of undefined constant的解决方法分享给大家供大家参考,具体如下:

环境错误级别:error_reporting =E_ALL

某天我在研究一下PHP下的正则替换函数PErg_replace(),

示例:

代码:

brush:PHp;">
$subject="2222a2222fff222222222A22222";
$pattern = "/(a)/e";
$replacement= "md5($1)";//$1,取匹配到的内存变量的值(\1也可以,只不过要注意双引号内的转义)
echo preg_replace($pattern,$replacement,$subject);

脚本宝典总结

以上是脚本宝典为你收集整理的PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法分析全部内容,希望文章能够帮你解决PHP正则替换函数preg_replace()报错:Notice Use of undefined constant的解决方法分析所遇到的问题。

如果觉得脚本宝典网站内容还不错,欢迎将脚本宝典推荐好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。