跳转 重定向

    // http://localhost/thinkphp323/index.php/Home/Blog/result/id/5
    public function result($id){
        if((int)$id > 5){
            // 成功后跳转到新闻列表页面
            $this->success('新增成功,即将返回列表页面', '8');
        } else {
            // 错误页面的默认跳转页面是返回前一页,通常不需要设置
            $this->error('新增失败','4');
        }
    }    

    // http://localhost/thinkphp323/index.php/Home/Blog/redirecttest?id=5    
    public function redirecttest($id){
        if((int)$id > 5){
            // 
            $this->redirect('/News/Archive/show_system_var');
        } else {
            // 
            $this->redirect('/News/Archive/show_array');
        }        
    }

 

posted @ 2017-12-07 10:19  sky20080101  阅读(58)  评论(0)    收藏  举报