mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-01 04:57:23 +00:00
clarified usage of the dump function (closes #718)
This commit is contained in:
+11
-5
@@ -14,13 +14,19 @@ introspecting its variables:
|
||||
|
||||
.. note::
|
||||
|
||||
The ``debug`` function is not available by default. You must load it explicitly::
|
||||
The ``dump`` function is not available by default. You must add the
|
||||
``Twig_Extension_Debug`` extension explicitly when creating your Twig
|
||||
environment::
|
||||
|
||||
$twig = new Twig_Environment($loader, $config);
|
||||
$twig = new Twig_Environment($loader, array(
|
||||
'debug' => true,
|
||||
// ...
|
||||
));
|
||||
$twig->addExtension(new Twig_Extension_Debug());
|
||||
|
||||
Even when loaded explicitly, it won't do anything if the ``debug`` option
|
||||
is not enabled.
|
||||
Even when enabled, the ``dump`` function won't display anything if the
|
||||
``debug`` option on the environment is not enabled (to avoid leaking debug
|
||||
information on a production server).
|
||||
|
||||
In an HTML context, wrap the output with a ``pre`` tag to make it easier to
|
||||
read:
|
||||
@@ -54,5 +60,5 @@ dumped:
|
||||
|
||||
Internally, Twig uses the PHP `var_dump`_ function.
|
||||
|
||||
.. _`XDebug`: http://xdebug.org/docs/display
|
||||
.. _`XDebug`: http://xdebug.org/docs/display
|
||||
.. _`var_dump`: http://php.net/var_dump
|
||||
|
||||
Reference in New Issue
Block a user