我正在尝试将组件从 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 上,您需要使用旧版 Controller ...尝试以下代码。
更改 JController::getInstance('Donation');
JControllerLegacy::getInstance('Donation');
关于php - fatal error :在 joomla 3 中调用未定义的方法 JController::getInstance(),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27328963/