質問

こんにちはいようにしているユーザープロファイルの作成のための私のサイトのurlというように

mysite.com/user/ChrisSalij

現在のコントローラのように見えい:

<?php   
class User extends Controller {
   function user(){
      parent::Controller();
   }

   function index(){
      $data['username'] =  $this->uri->segment(2);

      if($data['username'] == FALSE) {
         /*load default profile page*/
      } else {
         /*access the database and get info for $data['username']*/
         /*Load profile page with said info*/
      }//End of Else
   }//End of function
}//End of Class
?>

現在んが404エラーまた行くことができます

mysite.com/user/ChrisSalij

ことにあるからだと思うので期待があることになChrisSalij.でも思っ誤用をこのuri->セグメント();コマンドによっP

の手によりお願い申し上げます。感謝

役に立ちましたか?

解決

そのためのコントローラーで機能を呼ChrisSalij.

はこれを解決する方法:

1)の変更

function index(){ 
$data['username'] =  $this->uri->segment(2);

する

function index($username){ 
$data['username'] =  $username; 

利用のurl mysite.com/user/index/ChrisSalij

2)の場合のみのインデックスのURLが変更に呼ばれる関数の形状のみを使用 ルーティング

使う、

$route['user/(:any)'] = "user/index/$1";

を正確に地図のURL mysite.com/user/ChrisSalij

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top