微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

php – 如何在codeigniter中的不同页面上显示多个视图

嘿家伙我是codeigniter的新手我想在不同的页面显示多重视图..我创建一个页面,我在其上创建一个编辑按钮,我希望当我点击编辑按钮我在另一页面上重新设置..我可以做什么那个. .请帮助
这是我的代码

class Edit extends CI_Controller
{
    function __construct()
    {
            parent::__construct();
    }
    function edit()
    {
        $this->load->helper('url');
        if($this->input->post('edit') == True)
        {
            redirect('edit');
        }
    }
}

解决方法:

查看1 :(您的链接存在的位置)

<?PHP echo anchor('Edit/edit', 'Edit Value'); // Here Edit is your controller and edit is the function name. ?>

在编辑控制器中修改它像这样:

class Edit extends CI_Controller
{
    function __construct()
    {
            parent::__construct();
    }

    function edit()
    {
        $this->load->helper('url');
        if($this->input->post('edit') == True)
        {
            //redirect('edit'); //Do not use this as this line will call the same function again.
            $this->load->view('edit_view'); // where edit_view.PHP is present in your views directory. 
        }
    }
}

希望这可以帮助.

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐