system system.base system.caching system.caching.dependencies system.collections system.console system.db system.db.ar system.db.schema system.db.schema.mssql system.db.schema.mysql system.db.schema.oci system.db.schema.pgsql system.db.schema.sqlite system.i18n system.i18n.gettext system.logging system.utils system.validators system.web system.web.actions system.web.auth system.web.filters system.web.helpers system.web.renderers system.web.services system.web.widgets system.web.widgets.captcha system.web.widgets.pagers

CVarDumper

system.utils
继承 class CVarDumper
可用自 1.0
版本 $Id$
CVarDumper is intended to replace the buggy PHP function var_dump and print_r. It can correctly identify the recursively referenced objects in a complex object structure. It also has a recursive depth control to avoid indefinite recursive display of some peculiar variables.

CVarDumper can be used as follows,
CVarDumper::dump($var);

公共方法

隐藏继承的方法

方法描述被定义在
dump() Displays a variable. CVarDumper
dumpAsString() Dumps a variable in terms of a string. CVarDumper

方法详情

dump() 方法
public static void dump(mixed $var, integer $depth=10, boolean $highlight=false)
$var mixed variable to be dumped
$depth integer maximum depth that the dumper should go into the variable. Defaults to 10.
$highlight boolean whether the result should be syntax-highlighted

Displays a variable. This method achieves the similar functionality as var_dump and print_r but is more robust when handling complex objects such as Yii controllers.

dumpAsString() 方法
public static string dumpAsString(mixed $var, integer $depth=10, boolean $highlight=false)
$var mixed variable to be dumped
$depth integer maximum depth that the dumper should go into the variable. Defaults to 10.
$highlight boolean whether the result should be syntax-highlighted
{return} string the string representation of the variable

Dumps a variable in terms of a string. This method achieves the similar functionality as var_dump and print_r but is more robust when handling complex objects such as Yii controllers.