[英]I get a “Deprecated” notice on my page with few of the session functions
I am getting the below message on my sites page there are more than 20 messages like this... pls guide me to rectify the issue... I am using the PHP 5.3.0 我在我的网站页面上收到以下消息,有20多个这样的消息...请指导我纠正问题...我正在使用PHP 5.3.0
Deprecated: Function eregi() is deprecated in C:\\wamp\\www\\bannerbuzz\\includes\\classes\\language.php on line 87 不建议使用:函数eregi()在第87行的C:\\ wamp \\ www \\ bannerbuzz \\ includes \\ classes \\ language.php中已弃用
> UPDATE : Is there any way to switch off this display of error? >更新:有什么办法可以关闭此错误显示?
The correct answer to your question is: use a different error setting on your site. 您问题的正确答案是:在您的网站上使用其他错误设置。 You can do that in one of 3 ways. 您可以通过以下三种方式之一进行操作。
Change the php.ini file, if you have the right to. 如果有权,请更改php.ini文件。
error_reporting = E_ERROR
display_errors = Off
Add an .htaccess file to the root directory of your site You also have to have the right to do this. 将.htaccess文件添加到站点的根目录中,您还必须具有执行此操作的权限。 Add the following lines: 添加以下行:
php_flag display_errors off
php_value error_reporting E_ERROR
Execute the following statements in the beginning of your script 在脚本开头执行以下语句
error_reporting(E_ERROR);
ini_set("display_errors","Off");
However, in concurrence with the other answers given, the errors you get are errors and you should resolve them. 但是,与给出的其他答案一致,您得到的错误就是错误,应该解决。 Most of the time you want to show errors in your development environment and suppress and log them in your production environment. 大多数时候,您想在开发环境中显示错误,并在生产环境中排除和记录错误。 But you always want to solve them. 但是您始终想解决它们。
Check out the PHP manual for more info on errors. 查阅PHP手册以获取有关错误的更多信息。
Perhaps because the function is deprecated? 也许是因为该功能已被弃用? You can always change the error_reporting settings, but it's better that you stop using deprecated functions ! 您可以随时更改error_reporting设置,但是最好不要使用不推荐使用的功能 !
This function has been DEPRECATED as of PHP 5.3.0. 自PHP 5.3.0起已弃用此功能。 Relying on this feature is highly discouraged. 强烈建议不要使用此功能。
I believe it is also removed as of PHP 6. Why not just use preg_match? 我相信从PHP 6起它也会被删除。为什么不只使用preg_match?
In PHP 5.3, there are certain things that are deprecated, that is no more supported, however, there exists an alternative for them in php 5.3 for you to use. 在PHP 5.3中,有些东西已被弃用,不再受支持,但是在php 5.3中有一种替代方法供您使用。
See complete list of: 查看完整清单:
Deprecated features in PHP 5.3.x PHP 5.3.x中不推荐使用的功能
Note: The ereg
is removed, you can use preg
family of functions instead. 注意: ereg
被删除,您可以改用preg
系列功能。
In my case, I'm using a third party library which makes use of the eregi function. 就我而言,我正在使用利用eregi函数的第三方库。 In that case, there's an easy solution to hide those warnings. 在这种情况下,有一个简单的解决方案可以隐藏这些警告。 Just place ob_start() and ob_end_clean() at the beginning and the end of the code: 只需将ob_start()和ob_end_clean()放在代码的开头和结尾:
ob_start();
// third party code
// and more code ...
if (eregi("blah", $var)) { // <-- this code is throwing a warning
// ..
}
// and more code ...
ob_end_clean();
And that's all. 就这样。
Try preg_match or preg_replace, functions that aren't depreciated :) 尝试preg_match或preg_replace,未折旧的函数:)
For changing the error level: 要更改错误级别:
http://php.net/manual/en/function.error-reporting.php http://php.net/manual/en/function.error-reporting.php
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.