2012-01-11 5 views
2

私はちょっとしたことがありますが、CIがこのように動作するように設計されているかどうかはわかりません。CIスタティックD/C/MルートとURIパラメータ

私はサブドメインを持っている、ウォーレンにアクセスするときにロードされ、メインのindex.phpから分離されたCIのindex.phpを、にtest.warren.com

test.warren.comポイントを、それを呼び出すことができます。 com。 CIごと

/* 
* -------------------------------------------------------------------- 
* DEFAULT CONTROLLER 
* -------------------------------------------------------------------- 
* 
* Normally you will set your default controller in the routes.php file. 
* You can, however, force a custom routing by hard-coding a 
* specific controller class/function here. For most applications, you 
* WILL NOT set your routing here, but it's an option for those 
* special instances where you might want to override the standard 
* routing in a specific front controller that shares a common CI installation. 
* 
* IMPORTANT: If you set the routing here, NO OTHER controller will be 
* callable. In essence, this preference limits your application to ONE 
* specific controller. Leave the function name blank if you need 
* to call functions dynamically via the URI. 
* 
* Un-comment the $routing array below to use this feature 
* 
*/ 
    // The directory name, relative to the "controllers" folder. Leave blank 
    // if your controller is not in a sub-folder within the "controllers" folder 
    $routing['directory'] = 'subdir'; 

    // The controller class file name. Example: Mycontroller 
    $routing['controller'] = 'testcontroller'; 

    // The controller function you wish to be called. 
    $routing['function'] = 'testmethod'; 

をコメントとして

test.warren.comのindex.phpのは、定義された静的ルートを持っている今、このすべてがダンディな作品 - 私は私の一方法のウェブサイトを持っています。他にアクセスできるものはありません。その方法だけ。私がtest.warren.comに行くと、私はtestmethod()によって実行されるものを得ます。

さて、私が行うことができない部分が - URIのparams EGに渡しです:test.warren.com/param1/param2/param3 ---私の知る限り、この理由をデバッグできるよう404

ルータクラスが初期化されると、 'param1'がコントローラクラスかディレクトリかをチェックしようとするためです。これは、標準的なCI構成が期待するものと同じです。そして、その後404s。

index.phpの最後にロードされているメインコア/ CodeIgniter.phpを編集して回避することができます。このCIのインストールには複数のサイトがインストールされているので、私は非常に気にしません。

CIはv2.0.3

でこれが可能であれば誰でも知っていますか?

+0

example.warren.com/param1/param2/param3の例のように、ドメイン名の直後にパラメータを直接渡そうとしていますか? –

答えて

0

このように「デフォルトルート」を使用している場合は、パラメタを渡すためにセカンダリルートを設定する必要があります。 (もし

$route['(:any)/(:any)/(:any)'] = 'controller/action/$1/$2/$3'; 

すなわち、これは仕事、それに合わせて、次の3つのパラメータを渡す必要があり、「すべきである」とあなたは3を通過しない場合は、デフォルトのコントローラまたは404に戻ります1つまたは2つだけが渡されます。)

希望しますか?

関連する問題