如何在 fuelphp 中允许来自应用程序的 post 请求

how to allow post request from app in fuelphp

我要从我的 android 应用向 fuelphp 控制器发送 post 请求。但控制器不接受 post 请求。有什么方法可以让控制器接受来自我的应用程序的 post 请求??

谢谢

首先检查关于 csrf 的燃料配置

 'csrf_autoload_methods'    => array('post', 'put', 'delete'),

那么你应该使用 restcontroller

class Controller_Test extends Controller_Rest
{

    public function get_list()
    {
        return $this->response(array(
            'foo' => Input::get('foo'),
            'baz' => array(
                1, 50, 219
            ),
            'empty' => null
        ));
    }
}