dqpu4988
dqpu4988
2010-05-24 07:10

我的页面上有一个“弃用”通知,其中包含很少的会话功能

已采纳

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

Deprecated: Function eregi() is deprecated in C:\wamp\www\bannerbuzz\includes\classes\language.php on line 87

> UPDATE : Is there any way to switch off this display of error?

  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享
  • 邀请回答

5条回答

  • dpnhp20440 dpnhp20440 11年前

    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.

    See complete list of:

    Deprecated features in PHP 5.3.x

    Note: The ereg is removed, you can use preg family of functions instead.

    点赞 评论 复制链接分享
  • doudengshen5591 doudengshen5591 11年前

    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.

    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. 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.

    点赞 评论 复制链接分享
  • duanlei2150 duanlei2150 11年前

    Perhaps because the function is deprecated? You can always change the error_reporting settings, but it's better that you stop using deprecated functions!

    From PHP.net:

    This function has been DEPRECATED as of 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?

    点赞 评论 复制链接分享
  • dongna1593 dongna1593 11年前

    Try preg_match or preg_replace, functions that aren't depreciated :)

    For changing the error level:

    http://php.net/manual/en/function.error-reporting.php

    点赞 评论 复制链接分享
  • douzhe3516 douzhe3516 9年前

    In my case, I'm using a third party library which makes use of the eregi function. 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();
    // 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.

    点赞 评论 复制链接分享