【问题标题】:Strict Standards: Non-static method modJumiHelper::getCodeWritten() should not be called statically严格标准:不应静态调用非静态方法 modJumiHelper::getCodeWritten()
【发布时间】:2014-06-24 09:06:28
【问题描述】:

我的网站上有这些错误:

严格标准:非静态方法 modJumiHelper::getCodeWritten() 不应在第 17 行的 /home/kmxsiksf/www/modules/mod_jumi/mod_jumi.php 中静态调用

严格标准:非静态方法 modJumiHelper::getStorageSource() 不应在第 18 行的 /home/kmxsiksf/www/modules/mod_jumi/mod_jumi.php 中静态调用

这里是 mod_jumi.php(第 17 行和第 18 行分别以 $code_written 和 $storage_source 开头)

defined('_JEXEC') or die('Restricted access');
if(!defined('DS')){
    define('DS',DIRECTORY_SEPARATOR);
}
// Include the functions only once
require_once(dirname(__FILE__).DS.'helper.php');


$code_written   = modJumiHelper::getCodeWritten($params); //code written or ""
$storage_source = modJumiHelper::getStorageSource($params); //filepathname or record id or ""

if(is_int($storage_source)) { //it is record id
    $code_stored = modJumiHelper::getCodeStored($storage_source); //code or null(error]
}

require(JModuleHelper::getLayoutPath('mod_jumi'));

我为这个问题找到了许多解决方案,可以将函数转换为非静态函数,但是因为我对 PHP 了解不多,所以我找不到让它们工作的方法。

非常感谢您的帮助!

【问题讨论】:

    标签: php joomla static joomla-extensions non-static


    【解决方案1】:

    这个错误是因为getCodeWritten和getStorageSource函数不是静态函数。

    而不是像这样声明:

    public static function getCodeWritten()
    

    它们是这样声明的:

    public function getCodeWritten()
    

    请注意,“修复”此问题可能会导致其他问题。最好的办法是联系创建扩展程序的人。

    【讨论】:

    • 感谢您的帮助!你的意思是getCodeWritten和getStorageSource是在另一个.php中声明的
    • @Arone 是的。如果我是你,我会看看名为 modJumiHelper 的类文件。
    • 非常感谢,它正在工作! (对于 /modules/mod_jumi/helper.php 中第 14 行和第 18 行的其他替换)以及如果您注意到类似:严格标准:仅变量应通过引用分配...删除那些上的所有“&”行。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2013-04-02
    • 1970-01-01
    • 2013-03-31
    • 2015-05-08
    • 2011-06-08
    • 1970-01-01
    相关资源
    最近更新 更多