简体   繁体   English

简单的Joomla模块中的PHP严格标准错误?

[英]PHP strict standard error in simple Joomla module?

I'm doing a tutorial on joomla module, but I'm getting a strict standard error with PHP. 我正在做有关joomla模块的教程,但是我在使用PHP时遇到了严格的标准错误。

Error: 错误:

Strict standards: Non-static method modReviewsHelper::getReviews() should not be called statically in C:\\wamp\\www\\Joomla_2.5\\modules\\mod_reviews\\mod_reviews.php on line 7 Call Stack 严格标准:不应在第7行调用堆栈的C:\\ wamp \\ www \\ Joomla_2.5 \\ modules \\ mod_reviews \\ mod_reviews.php中静态调用非静态方法modReviewsHelper :: getReviews()

mod_reviews.php mod_reviews.php

<?php

defined('_JEXEC')or die('Restricted access here?');

require_once(dirname(__FILE__).DS.'helper.php');

$reviews = modReviewsHelper::getReviews($params);

require(JModuleHelper::getLayoutPath('mod_reviews'));
?>

helper.php helper.php

<?php
class modReviewsHelper{

    function getReviews( $params ){
        return 'I am a happy user!';
    }
}
?>

tmpl/default.php tmpl / default.php

<?php
defined('_JEXEC')or die('Restricted access here?');
echo $reviews;
?>

How do I fix this and to make sure that this does not happen in the future? 如何解决此问题并确保将来不会发生这种情况?

<?php
class modReviewsHelper{

    static function getReviews( $params ){
        return 'I am a happy user!';
    }
}
?>

Go to back end in joomla 转到joomla的后端
1) click administrator -> Global configuration 1)单击管理员->全局配置
2) go to server tab 2)转到服务器选项卡
3) make error reporting : "NONE" in server setting :-) 3)在服务器设置中进行错误报告:“无” :-)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM