我的 url 数据未传递到我的 codeigniter 控制器的函数
我使用的域名是 http://www.domainname.com/admin/users/edit/1
class Cal_Admin extends Controller {
function Cal_Admin()
{
parent::Controller();
$this->load->model('events/model_events');
$this->load->model('users/model_users');
}
function index()
{
$data['events'] = $this->model_events->get_home_entries();
$data['users'] = $this->model_users->_get_all();
$this->load->view('admin/admin_head');
$this->load->view('admin/admin_menu');
$this->load->view('admin/admin',$data);
$this->load->view('admin/admin_foot');
}
function users($action=NULL, $uid=NULL)
{
$this->load->view('admin/admin_head');
$this->load->view('admin/admin_menu');
$segments = $this->uri->total_segments();
switch ($action) {
case "add" :
$this->load->view('admin/users/form');
break;
case "edit" :
$data['user'] = $this->model_users->_get_user($uid);
$this->load->view('admin/users/form',$data);
break;
default:
$data['users'] = $this->model_users->_get_all();
$data['action'] = $action;
$this->load->view('admin/users',$data);
}
$this->load->view('admin/admin_foot');
}
The domain I'm using is http://www.domainname.com/admin/users/edit/1
class Cal_Admin extends Controller {
function Cal_Admin()
{
parent::Controller();
$this->load->model('events/model_events');
$this->load->model('users/model_users');
}
function index()
{
$data['events'] = $this->model_events->get_home_entries();
$data['users'] = $this->model_users->_get_all();
$this->load->view('admin/admin_head');
$this->load->view('admin/admin_menu');
$this->load->view('admin/admin',$data);
$this->load->view('admin/admin_foot');
}
function users($action=NULL, $uid=NULL)
{
$this->load->view('admin/admin_head');
$this->load->view('admin/admin_menu');
$segments = $this->uri->total_segments();
switch ($action) {
case "add" :
$this->load->view('admin/users/form');
break;
case "edit" :
$data['user'] = $this->model_users->_get_user($uid);
$this->load->view('admin/users/form',$data);
break;
default:
$data['users'] = $this->model_users->_get_all();
$data['action'] = $action;
$this->load->view('admin/users',$data);
}
$this->load->view('admin/admin_foot');
}
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我自己修好了。
我在 autoload.php 文件中重新声明了 uri 库。我知道 cal_admin 是这个类,我在 url 中使用它,由于某种原因我在示例中将其取出。
I Fixed it myself.
I had the uri library redeclared in the autoload.php file. I know the cal_admin was the class and I was using it in the url, i took it out for some reason in the example.