ページを表示するときにユーザーIDをURLに添付しようとしています。または、別のユーザーのページを表示するときに同じことを行います。Unable to load the requested file: account/profile/218.php
このコードでこのエラーが発生しています:
//Routes.php
$route['default_controller'] = "home";
$route['404_override'] = '';
$route['profile/:num'] = "account/profile";
//I've also tried doing
$route['profile/([a-z]+)/(\d+)'] = "profile/$1/id_$2";
// 上記のエラーを生成する uri セグメントのないコントローラー:
public function profile()
{
$this->load->helper('date');
$this->load->library('session');
$session_id = $this->session->userdata['id'];
$this->load->model('account_model');
$user = $this->account_model->user();
$data['user'] = $user;
$data['profile_icon'] = 'profile';
$data['main_content'] = 'account/profile/'.$user['id'];
$this->load->view('includes/templates/profile_template', $data);
}
そして私がこれを使うとき:
public function profile()
{
$this->load->helper('date');
$this->load->library('session');
$session_id = $this->session->userdata['id'];
$this->load->model('account_model');
$user = $this->account_model->user();
$data['user'] = $user;
$user['id'] = $this->uri->segment(4);
$data['profile_icon'] = 'profile';
$data['main_content'] = 'account/profile/'.$user['id'];
$this->load->view('includes/templates/profile_template', $data);
}
次のエラーが発生します。
要求されたファイルを読み込めません: account/profile/.php
* *編集
HTACCESS
Deny from all
RewriteEngine on
RewriteCond $1 !^(index\.php|images|robots\.txt)
RewriteRule ^(.*)$ /index.php/$1 [L]