This repository has been archived on 2024-04-08. You can view files and clone it, but cannot push or open issues or pull requests.
khosb/includes/kohana/modules/userguide/guide/debugging.code.md
2011-05-03 09:49:01 +10:00

853 B

Debugging

Kohana includes several powerful tools to help you debug your application.

The most basic of these is [Kohana::debug]. This simple method will display any number of variables, similar to var_export or print_r, but using HTML for extra formatting.

// Display a dump of the $foo and $bar variables
echo Kohana::debug($foo, $bar);

Kohana also provides a method to show the source code of a particular file using [Kohana::debug_source].

// Display this line of source code
echo Kohana::debug_source(__FILE__, __LINE__);

If you want to display information about your application files without exposing the installation directory, you can use [Kohana::debug_path]:

// Displays "APPPATH/cache" rather than the real path
echo Kohana::debug_path(APPPATH.'cache');