php - fatal error :在 joomla 3 中调用未定义的方法 JController::getInstance()

标签 php joomla components joomla-component joomla3.3

我正在尝试将组件从 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/

相关文章:

php - Laravel 黄昏 'No tests executed!'

php - Laravel- 在多个表中搜索一个 ID

php - 如何在 MySql 中检索当前周数据?

javascript - 在javascript中获取站点根url

components - Sparx Enterprise Architect (EA) 中的嵌套组件

javascript - 使用vuejs在get方法上刷新组件

php - 在同一个类中调用 __call 而不是 __callstatic,而不是调用另一个类

php - 在 Joomla 模块中使用区域设置日期格式

javascript - Google Analytics - 调整后的跳出率没有太多数据

coldfusion - 使用 cfinvoke 和 createObject 运行组件函数有什么区别?