セグメントについて
ちょっとおかしいのかな?とおもう部分を見つけました。
defaultコントローラーがtopコントローラーだとします。
このときに
http://localhost/
とすると
print_r($this->uri->segments); echo "<BR>"; print_r($this->uri->rsegments); exit;
これの表示は
Array ( ) Array ( [1] => top [2] => index )
となります
つまり、何もついてないのでarray()
で、rsegmentsはTOPコントローラー、INDEXメソッドと判断して値を返してくれ
ています。
http://localhost/test/
とした場合は
Array ( [1] => top ) Array ( [1] => top [2] => index )
次に
topコントローラーを
controller/test/top.phpにおいた場合
次のようになります。
http://localhost/test
Array ( [1] => test )
Array ( )
これを、
http://localhost/test/top
としたら
Array ( [1] => test [2] => top ) Array ( [1] => top [2] => index )
となります。
test/ディレクトリで切った場合、自動的にtest/topコントローラーを見に行
く?とおもうのですが、その場合rsegmentsの値が
array()になっています。
この場合も
Array ( [1] => top [2] => index )
となるのが正しいのではないで
しょうか?
どうなんでしょう?