简体   繁体   English

我在页面上收到“已弃用”通知,其中包含一些会话功能

[英]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设置,但是最好不要使用不推荐使用的功能

From PHP.net : PHP.net

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.

相关问题 打开页面时出现通知错误 - I get a notice error when I open up my page 我无法获取/访问我的会话变量的值到另一个页面 - I cant get/access the value of my session variables to another page 如何让我的 php 表单显示成功通知? - How do I get my php form to display a succes notice? 如果直接粘贴检查会话是否已设置的页面链接,为什么会收到通知错误? - Why I am getting notice error if I directly paste the link of a page which is checking if the session is set or not? 如何将会话值获取到我的网页上 - how to get the session values on to my web page 如何在PHP网页中获取登录Web应用程序的会话ID? - How do i get a session id of a Login Web-Application in my PHP web-page? 无法使糖注意到我的模块入口点 - Can not get sugar to notice my entrypoint of module 如果我的 php 会话未设置,则会收到通知。 如何解决这个问题? (注意:未定义索引:我的名字...) - getting notice if my php session is not set. how to resolve this? (<b>Notice</b>: Undefined index: myname...) Psr-4 已弃用 laravel 中的通知 - Psr-4 deprecated Notice in laravel 我正在尝试使用 ajax POST 方法从 html 页面将数据发送到我的 PHP 页面,但它给出错误,注意:未定义索引: - I am trying to send data to my PHP page from html page using ajax POST method but it give error ,Notice: Undefined index:
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM