We are moving our forum in GitHub Discussions. For questions about Phalcon v3/v4 you can visit here and for Phalcon v5 here.

about this or response

excuse me

use Phalcon\Mvc\Controller;

class ApiController extends Controller {
  public function machineAction() {
    $this->jsonAction(['code' => '0']);
  public function notfoundAction() {
    $this->response->setContentType('application/json', 'UTF-8');
    $this->response->setJsonContent(['code' => '0']);
    return false;

  public function jsonAction($param) {
    $this->response->setContentType('application/json', 'UTF-8');
    return false;

/api/machine not work

/api/notfound is ok

I try to read https://docs.phalcon.io/zh/3.3/api/Phalcon_Http_Response

but nothing to help me

You should use the dispatcher to forward to other actions

  public function machineAction() {
        'action' => 'json',
        'params' => ['code'=>0],


You need to return your response:

  return $this->jsonAction(['code' => '0']);

edited Jul '18

[code] public function jsonAction($param) { $this->response->setContentType('application/json', 'UTF-8'); $this->response->setJsonContent($param); $this->response->setStatusCode(200, "OK"); return $this->response->send(); }