Function eregi is deprecated (解决方法)
在php升级到php5.3之后后,在使用的过程经常发现有的程序会出现Function eregi() is deprecated 的报错信息。是什么原因呢?
这是因为php5.3中不再支持eregi()函数,而使用preg_match()函数替代。
解决的方法是:将eregi()函数替换成preg_match() 函数。
if(eregi('^test',$file))
可以替换为
if(preg_match('/^test/i',$file))
————-
PHP 5.3.0 之後的 regex, 希望使用 PCRE 的規格, POSIX Regex 都不建議使用了(統一 Regex, 避免規格太多?).
所以下述是不建議使用的 Function (POSIX), 與建議替換成的 Function (PCRE) 列表, 詳可見: PHP:
Differences from POSIX regex
* POSIX → PCRE
* ereg_replace() → preg_replace()
* ereg() → preg_match()
* eregi_replace() → preg_replace()
* eregi() → preg_match()
* split() → preg_split()
* spliti() → preg_split()
* sql_regcase() → No equivalent
* 需要 regex 的 split, 可用 preg_split() 代替
* 不需要 regex, 只要要快速分割固定的字串, 可用 explode() 代替. (速度會比需要 regex 的快很多)
Function eregi is deprecated (解决方法)相关推荐
- phpredis 报错 “Function Redis::setTimeout() is deprecated” 解决方法
phpredis 报错 "Function Redis::setTimeout() is deprecated" 解决方法 参考文章: (1)phpredis 报错 "F ...
- Function eregi() is deprecated
在php升级到php5.3之后后,在使用的过程经常发现有的程序会出现Function eregi() is deprecated 的报错信息.是什么原因呢? 这是因为php5.3中不再支持eregi( ...
- Deprecated:function eregi() is deprecated in /usr/local/apache/libraries/lib_lang.php on line 8
Deprecated:function eregi() is deprecated in /usr/local/apache/libraries/lib_lang.php on line 8 Depr ...
- [Vue warn]: Failed to mount component: template or render function not defined. 错误解决方法
[Vue warn]: Failed to mount component: template or render function not defined. 错误解决方法 参考文章: (1)[Vue ...
- hive初始化元数据的时候出现 Error:FUNCTION ‘NUCLEUS_ASCII‘ already exists解决方法
hive初始化元数据的时候出现 Error:FUNCTION 'NUCLEUS_ASCII' already exists解决方法 执行 schematool --initSchema -dbType ...
- php undefined function 几个函数,PHP Fatal error: Call to undefined function 函数名() in 解决方法...
PHP Fatal error: Call to undefined function 函数名() in 解决方法 发布于 2015-01-14 08:55:15 | 219 次阅读 | 评论: 1 ...
- 【C语言】warning: implicit declaration of function ‘xxx’ [-Wimplicit-function-declaration] 的解决方法
Linux开发C语言应用程序,编译出现以下四条warning: warning: implicit declaration of function 'strcmp' [-Wimplicit-funct ...
- 【C语言】warning: implicit declaration of function ‘usleep’ [-Wimplicit-function-declaration] 的解决方法
Linux环境下编译C语言程序,出现警告: warning: implicit declaration of function 'usleep' [-Wimplicit-function-declar ...
- 关于vue-video-plaer 出现 this.el_.vjs_getProperty is not a function at Flash.buff解决方法
用vue-video-play 播放rtmp/flv rtmp/mp4是出现上述错误如下: Uncaught TypeError: this.el_.vjs_getProperty is not a ...
- wordpress 安装(亲身经历) 出现“Fatal error: Call to undefined function get_magic_quotes_gpc()”之后的解决方法...
传说中wordpress是5分钟安装,可是昨天晚上安装了很长时间都没有安装好,先了卸掉了原来的appserv2.5.9,然后安装上了appserv2.6.0,(不要忘了备份原来的资料), 之后看了官网 ...
最新文章
- Linux下find命令的使用(命令+案例)
- 【迁移学习(Transfer L)全面指南】迁移学习中的bottlenecks(瓶颈层)
- PyQt5 图形界面 - 配置界面跟随窗口大小调整灵活伸缩,设置页面控件居中显示实例演示
- P3527 [POI2011]MET-Meteors 整体二分 + 树状数组
- [dp]leetcode 198. House Robber
- ip服务器ip地址信息配置,服务器ip地址配置
- HGAT-用于半监督短文本分类的异构图注意力网络
- 网易丁磊:创造中国特色文化精品,助力实现中国文化大时代
- latex中if语句怎么用_如果 (If) | Python 中的条件控制语句详解
- GIS实验之房价数据可视化分析
- 智能化的Conversational UI是移动发展的一个趋势
- java定义一个盒子类box_C++定义一个Box(盒子)类 看完你就知道了
- We‘re sorry but XXX doesn‘t work properly without JavaScript enabled. Please enable it to contin
- 【模电】NPN和PNP三极管的区别(一)
- 使用cpolar远程连接群晖NAS(创建临时链接)
- 判断通过微信、支付宝扫一扫进入的页面
- 什么是GCT考试,GCT考哪些课目(转)
- 【区块链技术与应用】(四)
- 公开密钥加密之RSA算法【概念+计算+代码实现】
- post表单时的html报文的header信息
热门文章
- php中的单引号和双引号
- 计算机无法连接steam,无法连接至steam网络怎么办 无法连接至steam网络解决方法【图文】...
- steam使用技巧2
- 解决latex伪代码标题序号问题
- 618什么数码产品值得入手、好评超高的数码产品排行榜
- 如何使计算机用户具有管理权限,如何把电脑普通用户权限提升超级管理员账户...
- PCA、最小平方差等中用拉格朗日求极值时对常见的一个f(x)=X'A'AX求导的证明
- python 监控文件变化 - python watchdog模块使用方法
- matlab经纬度画轨迹图_MATLAB绘制地图
- 使用Mac打开mht格式文件