php – 如何在codeigniter中的不同页面上显示多个视图
发布时间:2020-12-13 16:20:43 所属栏目:PHP教程 来源:网络整理
导读:嘿家伙我是codeigniter的新手我想在不同的页面上显示多重视图..我创建一个页面,我在其上创建一个编辑按钮,我希望当我点击编辑按钮我在另一页面上重新设置..我可以做什么那个. .请帮助 这是我的代码: class Edit extends CI_Controller{ function __construc
嘿家伙我是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. } } } 希望这可以帮助. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐
热点阅读