Closed Freest10 closed 6 years ago
Inside the template, you can do:
- header('Status: 404 Not Found');
| {
| "foo": "bar"
| }
- exit
Outside the template, you should rather not to call render or display method and just call raw PHP:
header('Status: 404 Not Found');
echo json_encode([
'foo' => 'bar',
]);
exit;
Thank you
Hello, I call the php method inside a pug template and I want that server to answer me 400 code with json in a pug template, how can I do this? header and the http_response_code php methods cause a template error.
Thanks!