php-致命错误:在joomla 3中调用未定义的方法JController :: getInstance()
作者:互联网
我正在尝试将组件从joomla2.5升级到joomla 3
但我收到此错误:
Fatal error: Call to undefined method JController::getInstance() in /home/evolve13/public_html/components/components/com_donation/donation.php on line 9
这是donation.php的代码:
<?php
// No direct access to this file
defined('_JEXEC') or die('Restricted access');
// import joomla controller library
jimport('joomla.application.component.controller');
// Get an instance of the controller prefixed by Donation
JController::getInstance('Donation');
// Perform the Request task
$controller->execute(JRequest::getCmd('task'));
// Redirect if set by the controller
$controller->redirect();
解决方法:
在Joomla 3X上,您需要使用旧版控制器…请尝试以下代码.
更改JController :: getInstance(‘Donation’);
到JControllerLegacy :: getInstance(‘Donation’);
标签:components,joomla,joomla-component,php,joomla3-3 来源: https://codeday.me/bug/20191121/2048167.html