phalcon (3.0) uses mvc control to provide RESTful api

Sometimes you need a JSON RESTful api interface in a MVC controller, which usually generate HTML results to users.

public function createAction() {
    	$this->view->disable();
        $resp = new \Phalcon\Http\Response();
        $resp->setHeader("Content-Type", "application/json");
        //.....
}

Leave a Reply

Your email address will not be published. Required fields are marked *