我在我的网站上使用Twitter登录。它适用于本地服务器。但是,在实时服务器中显示以下错误。什么时候,我点击Twitter登录按钮使用OpenCart。
NetworkError:500内部服务器错误
我在库中包含了twitter库文件,如下所示
我的 login.php 代码(控制器文件)
public function twtLoginRedirect() {
$this->load->library('EpiTwitter');
$this->load->library('EpiCurl');
$this->load->library('EpiOAuth');
/*include(DIR_SYSTEM . "library/EpiTwitter.php");
include(DIR_SYSTEM . "library/EpiCurl.php");
include(DIR_SYSTEM . "library/EpiOAuth.php");*/
$consumer_key = '*******';
$consumer_secret = '********';
$this->load->model('account/activity');
$this->load->model('account/customer');
$twitterObj = new EpiTwitter($consumer_key, $consumer_secret);
$authenticateUrl = $twitterObj->getAuthenticateUrl();
if(isset($authenticateUrl) && $authenticateUrl != '') {
$json['authenticateUrl'] = $authenticateUrl;
$json['result'] = 'success';
echo json_encode($json);
exit;
} else {
echo $json['result'] = 'error';
echo json_encode($json);
exit;
}
}
我的 Login.tpl 文件(tpl文件)
<a href="javascript:void(0);" onclick="twtloginredirect();" class="login_twt"> Log In With <span class="login_icon"></span> </a>
我的脚本重定向到Twitter网站登录
<script>
function twtloginredirect() {
$.ajax({
url: 'index.php?route=account/login/twtLoginRedirect',
dataType:'json',
type:'post',
success: function(res){
if(res['result'] && res['result'] == 'success') {
window.location= res['authenticateUrl'];
} else {
alert('something is wrong');
}
}
});
}
</script>