Home >Backend Development >PHP Tutorial >CodeIgniter 控制层文件互相跳方法问题

CodeIgniter 控制层文件互相跳方法问题

WBOY
WBOYOriginal
2016-06-23 14:39:16796browse

在controllers层里面有两个文件:
login.php
    public function index() {
         //跳到logintwo.php里面的index
}

----------------------------------------------
logintwo.php

 public function index() {
        var_dump("asdfasdf");
        $this->view('test',$this->getpagedata());
}

--------------------------
我之前用的方法是
 redirect(base_url('logintwo'));但是还是在本页面刷新了一遍而已,根本没有进入logintwo index 方法来


回复讨论(解决方案)

你想控制器当视图用吗?  那么直接可以用include

if ($logged_in == FALSE)
{
     redirect('/login/form/', 'refresh');
}

// with 301 redirect
redirect('/article/13', 'location', 301);

谢谢,我自己这边搞定了,是我继承的时候 没有写相关信息

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn