.htaccessで以下のようにアドレスをRewriteして、php側で処理しています。
http://172.16.16.117/tanto/tantomenu/ RewriteRule ([^/]*)\/([^/]*)\/$ http://172.16.16.117/index.php?control=$1&action=$2 [L]
php
1if ($this->get['control'] && $this->get['action']) { 2 array_push($this->params,$this->get['control'],$this->get['action']); 3}
これにパターンにマッチした文字列をもう一つ増やして
http://172.16.16.117/tanto/tantomenu/1/ RewriteRule ([^/]*)\/([^/]*)\/([^/]*)\/$ http://172.16.16.117/index.php?control=$1&action=$2¶m3=$3 [L] RewriteRule ([^/]*)\/([^/]*)\/$ http://172.16.16.117/index.php?control=$1&action=$2 [L]
php
1//3つ目のパラメーターが存在するとき。 2if (isset($this->get['param3'])) { 3 array_push($this->params,$this->get['control'],$this->get['action'],$this->get['param3']); 4}
という風にパラメータを増やして取得したいのですが、
Array ( [0] => tanto [1] => tantomenu [2] => tanto [3] => tantomenu [4] => 1 )
といった具合でうまく取得できません。
グループの回数で振分が出来ればいいような気がしますが、何か良い方法がありますでしょうか。
全く別の方法でも構いません。
よろしくお願いします。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/07/19 02:17
2017/07/19 04:57