简体   繁体   中英

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.

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

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

<?php
class modReviewsHelper{

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

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
1) click administrator -> Global configuration
2) go to server tab
3) make error reporting : "NONE" in server setting :-)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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