Xampp localhost严格标准错误

时间:2011-12-21 02:42:06

标签: php xampp localhost

甚至我改变了php.ini文件。 我改变了php.ini 默认值为:

; display_startup_errors
;   Default Value: Off
;   Development Value: On
;   Production Value: Off

; error_reporting
;   Default Value: E_ALL & ~E_NOTICE
;   Development Value: E_ALL | E_STRICT
;   Production Value: E_ALL & ~E_DEPRECATED

我将它们改为:

 display_startup_errors
   Default Value: Off
   Development Value: On
   Production Value: Off

 error_reporting
   Default Value: E_ALL & ~E_NOTICE
   Development Value: E_ALL | E_STRICT
   Production Value: E_ALL & ~E_DEPRECATED

我仍然遇到以下错误:

Strict Standards: Declaration of CUser::Save() should be compatible with that of CBase::Save() in D:\xampp\htdocs\web\newpacific\include\user.class.php on line 128
Strict Standards: Declaration of CUser::Add() should be compatible with that of CBase::Add() in D:\xampp\htdocs\web\newpacific\include\user.class.php on line 128
Strict Standards: Declaration of CUser::Edit() should be compatible with that of CBase::Edit() in D:\xampp\htdocs\web\newpacific\include\user.class.php on line 128
Strict Standards: Declaration of CNewsLetter::Save() should be compatible with that of CBase::Save() in D:\xampp\htdocs\web\newpacific\include\newsletter.class.php on line 89
Strict Standards: Declaration of CNewsLetter::Add() should be compatible with that of CBase::Add() in D:\xampp\htdocs\web\newpacific\include\newsletter.class.php on line 89
Strict Standards: Declaration of CNewsLetter::Edit() should be compatible with that of CBase::Edit() in D:\xampp\htdocs\web\newpacific\include\newsletter.class.php on line 89
Strict Standards: Declaration of CLanguage::UpdateSEO() should be compatible with that of CBase::UpdateSEO() in D:\xampp\htdocs\web\newpacific\include\language.class.php on line 186
Strict Standards: Declaration of CNav::Save() should be compatible with that of CBase::Save() in D:\xampp\htdocs\web\newpacific\include\nav.class.php on line 178
Strict Standards: Declaration of CNav::Edit() should be compatible with that of CBase::Edit() in D:\xampp\htdocs\web\newpacific\include\nav.class.php on line 178
Strict Standards: Declaration of CDatabase::GetAll() should be compatible with that of CBase::GetAll() in D:\xampp\htdocs\web\newpacific\include\database.class.php on line 119
Strict Standards: Declaration of CNews::GetMaxOrder() should be compatible with that of CBase::GetMaxOrder() in D:\xampp\htdocs\web\newpacific\include\news.class.php on line 160
Strict Standards: Declaration of CNews::UpdateOrder() should be compatible with that of CBase::UpdateOrder() in D:\xampp\htdocs\web\newpacific\include\news.class.php on line 160
Strict Standards: Declaration of CNavigation::GetMaxOrder() should be compatible with that of CBase::GetMaxOrder() in D:\xampp\htdocs\web\newpacific\include\navigation.class.php on line 75
Strict Standards: Declaration of CNavigation::UpdateOrder() should be compatible with that of CBase::UpdateOrder() in D:\xampp\htdocs\web\newpacific\include\navigation.class.php on line 75
Strict Standards: Declaration of CArticle::GetMaxOrder() should be compatible with that of CBase::GetMaxOrder() in D:\xampp\htdocs\web\newpacific\include\article.class.php on line 117

提前致谢。我在论坛上搜索过。没有弄清楚为什么它仍然会得到严格的标准错误

2 个答案:

答案 0 :(得分:1)

在xampp上测试过(没有它,所以只是想看)并在php.ini中设置“error_reporting = E_ALL & ~E_DEPRECATED”摆脱了严格的警告。请记住重新启动服务器(并注释您取消注释的行)以使其生效。

此外,您还可以确保功能符合标准。我在网上找到的东西:

class ParentClass
 {
        protected static function foo($param1, $param2)
         {
                echo "Parent\n";
         }
 }

class ChildClass extends ParentClass
 {
        public static function foo($param1)
         {
                parent::foo($param1, 2);
                echo "Child\n";
         }
 }

ChildClass::foo(1);

这会触发一个标准,因为foo与其他foo不匹配,但你只需输入:

        public static function foo($param1, $param2=2)
         {
                parent::foo($param1, 2);
                echo "Child\n";
         }

并使用$ param2或忽略它以消除警告,但如果采取,我会使用它...

答案 1 :(得分:0)

@craniumonempty我将php.ini重命名为其他名称,然后将php.ini-development文件重命名为php.ini现在没有错误了。希望这可以帮助某人

或者将error_reporting更改为error_reporting = E_ALL & ~E_NOTICE & ~E_DEPRECATED