0

我正在codeigniter中开发一个应用程序。我的文件夹架构是,

控制器——前端——成员——profile.php

如果我像这样访问它http://localhost/sample/www/index.php/frontend/members/profile,我会收到page not found错误消息。

我使用的是 codeigniter 2.1.3 版,我没有做任何 URL 重定向。

我打电话就像,

if($result) {
                $this->session->set_userdata('irid', $result);
                redirect('frontend/members/profile');
}
4

1 回答 1

2

如果错误,请更正文件系统..

//System File Dir = http://localhost/sample/www/

//Controller File Dir = controller/frontend/members/profile

//View File Dir = views/frontend/members/profile_view.php

// Controller - profile.php
if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Profile extend CI_Controller{
   function index(){
      $this->load->view('profile_view'); // you need to load the view like this..
   }
}

一般来说,在此过程中发生的错误是由您的控制器产生的。profile.php它往往会拉动视图。但找不到它的具体位置。这就是为什么它不断告诉文件或页面不存在或无法加载

注意:如果您想完全操纵每个阶段的隔离,如果您只是将 CI 转换为 hmvc 模式,那么它会很有用并且压力会更小,就像/registation,/profile,/auth,/home

于 2013-04-01T06:16:33.543 回答