网站首页php
网站登陆后跳回登陆之前页面的代码
发布时间:2017-04-26 02:12:47编辑:slayer.hover阅读(3480)
一、在后端控制器端加入:
public function loginAction(){
$referurl = $_SERVER['HTTP_REFERER'];
if(!empty($referurl)){
$rows = parse_url($referurl);
if(strpos($rows['host'], 'example.com')===FALSE){
$referurl= '';
}
}
$this->_view->assign('referurl', $referurl);
$this->show('login');
}二、在前端登陆页面中加入登陆成功后的跳转:
if(data.code==1){
window.location.replace("<?php echo (empty($referurl)) ? 'default.html' : $referurl;?>");
}
评论