2012-08-11 36 views
0

我正在做一個關於joomla模塊的教程,但我得到了一個嚴格的PHP標準錯誤。PHP在簡單的Joomla模塊中嚴格標準錯誤?

錯誤:

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; 
?> 

我該如何解決這個問題,並確保這種情況在未來不會發生?

+0

「不應該靜態調用非靜態方法」意味着如果您像這樣調用它,則應將該方法標記爲「靜態」。 – DCoder 2012-08-11 13:23:02

回答

0
<?php 
class modReviewsHelper{ 

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

進入到後端中的Joomla
1)單擊管理員 - >全局配置
2)去服務器標籤
3)作出錯誤報告: 「NONE」 服務器設置 : - )