Fuelphp を使用して、StackOverflow でこのような URL システムを使用して特定のページにアクセスできるようにしたいと考えています。
望ましい動作: -stackoverflow.com/questions -> 多くの質問があるページ -stackoverflow.com/questions/1982 -> 特定の質問があるページ
これが私のコントローラーです:
class Controllers_Images extends Controller_Template
{
public function action_index($id=null)
{
if($id)
{
//Use Model_Image to find specific image
//Create appropriate view
}
else
{
//Use Model_Image to find many images
//Create appropriate view
}
}
}
「汎用」ページにアクセスできますmysite.com/images/
-これは関数にルーティングされaction_index
ます。で「特定の」ページにアクセスできますmysite.com/images/index/1
。私がやりたいのはindex
、この場合もスキップできるようにすることmysite.com/images/1
です。現在、404 が表示されています。ルーティングを設定するにはどうすればよいですか?