1、错误和日志函数库
本库属于php的核心函数库,可以直接使用。主要有以下几个函数。
debug_print_backtrace和debug_backtrace
这两个函数实现相同的目的——记录php函数的调用堆栈——但是表现不同。debug_print_backtrace直接在输出内容中打印出调用堆栈内容,debug_backtrace将调用堆栈以数组的形式返回供php程序使用。
在我的一个数据字典载入类中debug_print_backtrace的输出如下:
#0 DictLoader->b2d(list_number, Array ([freepp] => 24009394,[contact] => 24005945)) called at [/var/www/freepp/DBALayer/User.php:430]
#1 User->_getOneRecordOfArray(list_number, contact, 24005945) called at [/var/www/freepp/DBALayer/User.php:456]
#2 User->getAContact(list_number, 24005945) called at [/var/www/freepp/freepp_b16/processADD.php:60]
#3 processADD(24009394) called at [/var/www/freepp/freepp_b16/principal.php:48]
#0 DictLoader->b2d(list_number, Array ([freepp] => 24005945,[contact] => 24009394)) called at [/var/www/freepp/DBALayer/User.php:430]
#1 User->_getOneRecordOfArray(list_number, contact, 24009394) called at [/var/www/freepp/DBALayer/User.php:456]
#2 User->getAContact(list_number, 24009394) called at [/var/www/freepp/freepp_b16/processADD.php:93]
#3 processADD(24009394) called at [/var/www/freepp/freepp_b16/principal.php:48]
DictLoader是调用该函数的类