Deprecated: Function eregi_replace()(不推荐使用:函数 eregi_replace())
问题描述
在 PHP 5.3.8 上运行时出现以下错误
I am getting the following error when running on PHP 5.3.8
已弃用:函数 eregi_replace() 在/home/XXXXXX/public_html/admin/modifypoll.php 第 49 行
Deprecated: Function eregi_replace() is deprecated in /home/XXXXXX/public_html/admin/modifypoll.php on line 49
这是代码行,请任何人帮忙
This is the line of code, can anyone help please
$question = eregi_replace('</?[a-z][a-z0-9]*[^<>]*>', '', $question );
我不知道要把它改成什么.有人可以帮忙吗
I am not sure what to change it to. Can anyone help please
推荐答案
整个 ereg 函数系列在 PHP 中都不推荐使用,并且会在某个时候从语言中删除.替代品是 preg 家族.大多数情况下,更改很简单:
the entire ereg family of functions are deprecated in PHP and will at some point be removed from the language. The replacement is the preg family. For the most part, the change is simple:
preg_replace('/[^<>]>/i', '', $question);
^-- ^ ^^
- 将 ereg 更改为 preg
- 添加分隔符 (
/
) - 对于不区分大小写的匹配 (ereg
i
),添加i
修饰符
- change ereg to preg
- add delimeters (
/
) - for case insensitive matches (ereg
i
), add thei
modifier
这篇关于不推荐使用:函数 eregi_replace()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:不推荐使用:函数 eregi_replace()


基础教程推荐
- 有什么方法可以用编码 UTF-8 而不是 Unicode 返回 PHP`json_encode`? 2021-01-01
- Cron Jobs 调用带有变量的 PHP 脚本 2022-01-01
- PHP PDO MySQL 查询 LIKE ->多个关键词 2021-01-01
- 在PHP中根据W3C规范Unicode 2022-01-01
- PHP 类:全局变量作为类中的属性 2021-01-01
- 如何替换eregi() 2022-01-01
- 如何在 Laravel 5.3 注册中添加动态下拉列表列? 2021-01-01
- 学说 dbal querybuilder 作为准备好的语句 2022-01-01
- YouTube API v3 点赞视频,但计数器不增加 2022-01-01
- 如何在 Laravel 中使用 React Router? 2022-01-01