Joomla's triggerEvent not working


Joomla's triggerEvent not working

我试图从外部php文件中为rsform Pro的支付插件调用jooomla triggerEvent函数。但我一直收到500个错误,我的服务器错误日志没有缓存错误代码。下面是我的代码,我还添加了我的参考。请帮我找出错误源。提前谢谢。

define( '_JEXEC', 1 );
define('JPATH_BASE', '../');
require_once ( JPATH_BASE .'/includes/defines.php' );
require_once ( JPATH_BASE .'/includes/framework.php' );      
require_once (JPATH_BASE. '/plugins/system/rsfppayment/rsfppayment.php');
jimport('joomla.application.component.controller');


  $updatedSubmissionId = 168;
    $mainframe = JFactory::getApplication();
    $mainframe->triggerEvent('rsfp_afterConfirmPayment', array($updatedSubmissionId));        

最好为您的插件制作自己的函数,然后使用另一个插件中的函数。但我会给出一个简短的说明,在你自己的插件代码中调用插件的方法(Joomla3+的最新版本):

步骤1:呼叫JPluginHelper::importPlugin( 'plugingroup' );

pluginggroup可以是rsfppayment插件所在的系统或插件文件夹。

步骤2:

$dispatcher = JEventDispatcher::getInstance();

步骤3:

$results = $dispatcher->trigger( 'rsfp_afterConfirmPayment', array($updatedSubmissionId) );

下面的代码应该可以做到这一点-可以在docs.joomla.org网站上找到更多信息https://docs.joomla.org/Triggering_content_plugins_in_your_extension.

// Note JDispatcher is deprecated in favour of JEventDispatcher in Joomla 3.x however still works.
JPluginHelper::importPlugin('system');
$dispatcher = JDispatcher::getInstance();
$dispatcher->trigger('rsfp_afterConfirmPayment', array($updatedSubmissionId));