本文介紹了不推薦使用:函數 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()的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!