How to use the var_dump output directly from the controller?

phalcon

Solution

if you don't see output from controller check if in your template file you have this line:

{{ content() }}

you can use php's var_dump in any place of your code:

var_dump($var);exit;

exit; is to stop anything what happens after this line.

You can also dump your vars in volt's template with volt's function:

{{dump(var)}}

dump() is same as var_dump() Here are some more useful volt functions:

http://docs.phalconphp.com/en/latest/reference/volt.html#functions

Problem

``` class IndexController extends \Phalcon\Mvc\Controller { public function indexAction() { $custom = "Custom variable"; var_dump($custom); } } ``` How to display the result not using the variables in the template? P.S. The result of the Echo function is also suppressed. I understand that this is the wrong approach, but it is a quick way to debug the variables.

Original source