0
我有幾個類(a,b,c等),它們擴展了一個名爲mother的抽象類。所有的「兒子」使用方法「拯救」:日誌的清理堆棧跟蹤
<?php
class mother {
public function save() {
echo "Mother saves!\n";
debug_print_backtrace();
}
}
class a extends mother {
public function save() {
echo "Calling save from A\n";
parent::save();
}
}
$test = new a;
$test->save();
?>
如果你運行這段代碼,debug_print_backtrace的結果是很乾淨,這正是我需要的:
#0 mother->save() called at [/home/xfiddlec/public_html/main/code_44364601.php:13] #1 a->save() called at [/home/xfiddlec/public_html/main/code_44364601.php:18]
的問題是,如果你正在使用框架(使用Zend2的Im),堆棧跟蹤超過1MB,一個巨大的字符串。如果有辦法我可以限制跟蹤覆蓋率?對於我的申請有文件,延長母親的班級和班級的名字就夠了。