不推荐使用PHP ereg_replace [英] PHP ereg_replace deprecated

查看:76
本文介绍了不推荐使用PHP ereg_replace的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个脚本会引发错误,因为我运行的是PHP 5.3.1
在示例中我必须使用什么?

I have a script that throws me errors because I run PHP 5.3.1
What Do I have to use in the example?

$row[$j] = ereg_replace("\n", "\\n", $row[$j]);

不推荐使用:函数ereg_replace()不推荐使用..

推荐答案

使用 preg_replace 代替,只需添加定界符.

$row[$j] = preg_replace("#\n#", "\\n", $row[$j]);

这篇关于不推荐使用PHP ereg_replace的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆