特定のメソッドを呼び出した人を知りたい場合は、debug_print_backtrace で解決できます!~
テストコード
1 <?php 2 class a{ 3 function say($msg) { 4 echo "msg:".$msg; 5 echo "<pre class="brush:php;toolbar:false">";debug_print_backtrace(); 6 } 7 } 8 9 class b {10 function say($msg) {11 $a = new a();12 $a->say($msg);13 }14 }15 16 class c {17 function __construct($msg) {18 $b = new b();19 $b->say($msg);20 }21 }22 23 $c = new c("test");
出力結果
msg:test#0 a->say(test) called at [/var/www/test/test0723.php:12]#1 b->say(test) called at [/var/www/test/test0723.php:19]#2 c->__construct(test) called at [/var/www/test/test0723.php:23]
関連リンク
http://ch2.php.net/manual /zh/function.debug-print-backtrace.php
http://ch2.php.net/manual/zh/function.debug-backtrace.php