Phalcon very slow using Phalcon\\Http\\Response();

☆樱花仙子☆ 提交于 2019-12-06 16:08:06

I went to this page: http://docs.phalconphp.com/en/latest/reference/response.html and they say that

If you are using the full MVC stack there is no need to create responses manually. However, if you need to return a response directly from a controller’s action follow this example:

<?php
class FeedController extends Phalcon\Mvc\Controller
{

    public function getAction()
    {
        // Getting a response instance
        $response = new \Phalcon\Http\Response();

        $feed = //.. load here the feed

        //Set the content of the response
        $response->setContent($feed->asString());

        //Return the response
        return $response;
    }

}
?>

As you can see it return directly the Response object.

I guess that you should call the ->send() outside the controller, and also adding some headers would help

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!