http://blog.sina.com.cn/s/blog_4f9fc6e10100rhn5.html
//调用堆栈函数,查找调用函数的源头,方便调试
function print_stack_trace()
{
}
我在我的数据库的核心查询函数里面调用这个方法,打印结果如下:
D:\wamp\www\meilele\includes\cls_mysql.php:471行,调用方法:query
D:\wamp\www\meilele\includes\cls_mysql.php:507行,调用方法:getAll
D:\wamp\www\meilele\includes\lib_common.php:732行,调用方法:getAllCached
D:\wamp\www\meilele\includes\init.php:113行,调用方法:load_config
D:\wamp\www\meilele\index.php:4行,调用方法:include_once
一目了然,一直找到了入口,太强悍了。以后调试又多了一种办法
或者用下面的方法:
$e = new Exception;
var_dump($e->getTraceAsString());