php - CakePHP how to set Content type header in appController? -
i have shared function extended controllers print give json object response.
i placed shared function "appcontoller.php" static function.
problem cannot access this-> in appcontroller.
question is:
how can solve it?
here code of function:
public static function printjsonoutput($responsedata) { $this->requesthandler->respondas('json'); $this->autorender = false; echo json_encode($responsedata); }
thanks help.
what want explained there in great detail, code examples , shown right way it.
what wrong , @nunser pointed out don't have access $this in static function. might want oop tutorial php first?
Comments
Post a Comment