[FuelPHP] メソッドがPOSTかGETかを判定する方法2014/10/20PHP43FuelPHP18目次post_index(),get_index()などでルーティングできない設計の場合。従来の方法本来は以下のように接頭辞にPOST/GETを指定することでルーティングすることができる。class Controller_Example extends Controller { public function get_index() { // HTTPメソッドがGETである場合に呼び出される } public function post_index() { // HTTP メソッドが POST である場合に呼び出される } }action_index()内での判定方法同一アクション内でPOST/GETを判定したい場合は以下のようにInput::method()を使用する。class Controller_Example extends Controller { public function action_index() { // GETの場合 if( Input::method() == 'GET' ) { } // POSTの場合 if( Input::method() == 'POST' ) { } } }Input クラスのmethod()は HTTP メソッドを返却する。(GET, POST, DELETE なんかが取れる)method($default = 'GET')StaticYesParametersParamDefaultDescription$default'GET'Default HTTP method.ReturnsstringExampleInput::method(); // "GET"引用: Input - Classes - FuelPHP Documentation