class a { function say($msg) { echo "msg:".$msg; echo "<pre>";debug_print_backtrace(); } } class b { function say($msg) { $a = new a(); $a->say($msg); } } class c { function __construct($msg) { $b = new b(); $b->say($msg); } } $c = new c("test"); ?若是咱們想知道某個方法被誰調用了? debug_print_backtrace能夠解決 debug_print_backtrace() 能夠打印出一個頁面的調用過程 , 從哪兒來到哪兒去一目瞭然. // 相關函數 http://us1.php.net/manual/zh/function.debug-backtrace.php