弃用:函数eregi_replace() [英] Deprecated: Function eregi_replace()

查看:132
本文介绍了弃用:函数eregi_replace()的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP 5.3.8上运行时出现以下错误:
$ b


弃用:函数eregi_replace()在$ b $中不推荐使用b /home/XXXXXX/public_html/admin/modifypoll.php on line 49


这是一行代码,任何人都可以帮忙

  $ question = eregi_replace('< /?[az] [a-z0-9] * [^<> ;] *>','',$ question); 

我不确定要将其更改为。
任何人都可以请求帮助

解决方案

整个ereg系列函数在PHP中被弃用,并且在某些时候会被删除来自语言。替代品是preg系列。大多数情况下,这种变化很简单:

$ $ $ $ $ $ $ $ $ $ preg_replace('/ [^<>]> / i' ,'',$问题);
^ - ^ ^^




  1. 将ereg更改为preg
  2. 为不区分大小写的匹配添加delimeters( /

  3. (ereg i ),添加 i 修饰符


I am getting the following error when running on PHP 5.3.8

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

解决方案

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);
^--           ^      ^^

  1. change ereg to preg
  2. add delimeters (/)
  3. for case insensitive matches (eregi), add the i modifier

这篇关于弃用:函数eregi_replace()的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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