質問: jeventdispatcher::getinstance(); $res=$dispatcher->trigger('oncheckanswer',$post['recaptcha_response_field']); if(!$res[0]){ die('invalid captcha'); } 上記のコードを配置しましたが、フォームを送信した後、空白のページが表示されます。理由を説明できますか?
回答: joomla 3.x正解 $joomla_captcha = jfactory::getconfig()->get('captcha'); if ( $joomla_captcha != '0') { jpluginhelper::importplugin('captcha'); $dispatcher = jdispatcher::getinstance(); // this will put the code to load recaptcha's javascript file into your <head> $dispatcher->trigger('oninit', 'dynamic_recaptcha_1'); // this will return the array of html code. $recaptcha = $dispatcher->trigger('ondisplay', array(null, 'dynamic_recaptcha_1', 'class="required"')); } そしてif (isset($recaptcha[0]) and $joomla_captcha != "0") { echo $recaptcha[0]; }