public function createCaptcha() { if (!$this->checkRequest()) { return false; } require_once 'lib/form/captcha.php'; $captcha = new \captcha(); $this->response->addHeader('Content-Type: application/json'); $this->response->setOutput(json_encode(['src' => $captcha->png(), 'code' => $captcha->getCode()])); }