首页 > 实用技巧 > PHP:Deprecated: Function set_magic_quotes_runtime() is deprecated 错误

PHP:Deprecated: Function set_magic_quotes_runtime() is deprecated 错误

在安装PHPCMS出现Deprecated: Function set_magic_quotes_runtime() is deprecated 错误,查了一下网络及资料发现是PHP5.3和PHP6.0之后移除了set_magic_quotes_runtime()函数。

set_magic_quotes_runtime(0)函数作用解释
在php.ini的配置文件中,有个布尔值的设置,就是magic_quotes_runtime,当它打开时,php的大部分函数自动的给从外部引入的(包括数据库或者文件)数据中的溢出字符加上反斜线。

当然如果重复给溢出字符加反斜线,那么字符串中就会有多个反斜线,所以这时就要用set_magic_quotes_runtime()与 get_magic_quotes_runtime()设置和检测php.ini文件中magic_quotes_runtime状态。

为了使自己的程序不管服务器是什么设置都能正常执行。可以在程序开始用get_magic_quotes_runtime检测设置状态秋决定是否要手工处理,或者在开始(或不需要自动转义的时候)用set_magic_quotes_runtime(0)关掉。

magic_quotes_gpc设置是否自动为GPC(get,post,cookie)传来的数据中的’"\加上反斜线。可以用 get_magic_quotes_gpc()检测系统设置。如果没有打开这项设置,可以使用addslashes()函数添加,它的功能就是给数据库查 询语句等的需要在某些字符前加上了反斜线。这些字符是单引号(’)、双引号(")、反斜线(\)与 NUL(NULL 字符)。

 

解决办法:

//@set_magic_quotes_runtime(0);

ini_set("magic_quotes_runtime",0);

就是用ini_set()办法替代原有的set_magic_quotes_runtime语法。

 


Deprecated: Function ereg() is deprecated错误解决办法!

Function ereg() is deprecated in drupal-6.15\includes\file.inc on line 904
open the file.inc in a good text editor other than notepad, go to the line number 904 to see the following line. Then comment the line and in the next line type the replaced code. this will solve the instalation issues and also most of other issues related to the same issue.

Change

elseif ($depth >= $min_depth && ereg($mask, $file)) {


to

elseif ($depth >= $min_depth && mb_ereg($mask, $file)) {


mb_ereg fortunatly is not deprecated





实用技巧->

无觅相关文章插件,快速提升流量