typecho程序的error_log文件提示

WBOY
Libérer: 2016-06-06 20:18:35
original
1572 Les gens l'ont consulté

typecho根目录下生成一个error_log文件
内容为:

<code>[03-Feb-2016 06:20:43 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:20:43 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:20:43 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:20:43 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
</code>
Copier après la connexion
Copier après la connexion

可否在/var/Typecho/Plugin.php文件中增加这一句?

<code>error_reporting( E_ALL & ~E_STRICT );</code>
Copier après la connexion
Copier après la connexion

这样有没有用,会不会对程序有影响?

回复内容:

typecho根目录下生成一个error_log文件
内容为:

<code>[03-Feb-2016 06:20:43 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:20:43 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:20:43 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:20:43 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
[03-Feb-2016 06:24:37 UTC] PHP Strict Standards:  call_user_func_array() expects parameter 1 to be a valid callback, non-static method Avatars_Plugin::avatars() should not be called statically in /home/...
</code>
Copier après la connexion
Copier après la connexion

可否在/var/Typecho/Plugin.php文件中增加这一句?

<code>error_reporting( E_ALL & ~E_STRICT );</code>
Copier après la connexion
Copier après la connexion

这样有没有用,会不会对程序有影响?

抑制错误的输出应该是治标不治本的~

而且尽量不要动核心代码,不然以后程序更新的时候可能会有意想不到的结果

所以我们应该从错误的根源入手:

这个报错是因为 Avatars 插件里面的 avatars() 函数没有声明成静态函数,而用 Avatars_Plugin::avatars() 的时候访问的是静态函数所以就出问题了,所以直接在 avatars 插件的 plugins.php 的 avatars 函数前面加一个 static 关键字就不会报错了

去下载了个 Avatars 插件看了看,应该是在 plugins.php 的 109 行,

<code>public function avatars($size,$rating,$default,$comments){</code>
Copier après la connexion

改成

<code>public static function avatars($size,$rating,$default,$comments){</code>
Copier après la connexion

就可以啦

Étiquettes associées:
source:php.cn
Déclaration de ce site Web
Le contenu de cet article est volontairement contribué par les internautes et les droits d'auteur appartiennent à l'auteur original. Ce site n'assume aucune responsabilité légale correspondante. Si vous trouvez un contenu suspecté de plagiat ou de contrefaçon, veuillez contacter admin@php.cn
Tutoriels populaires
Plus>
Derniers téléchargements
Plus>
effets Web
Code source du site Web
Matériel du site Web
Modèle frontal
À propos de nous Clause de non-responsabilité Sitemap
Site Web PHP chinois:Formation PHP en ligne sur le bien-être public,Aidez les apprenants PHP à grandir rapidement!