代码之家  ›  专栏  ›  技术社区  ›  zaf

父函数的名称和参数

  •  4
  • zaf  · 技术社区  · 15 年前

    例子:

    function foo($a,$b){
      bar();
    }
    
    function bar(){
      // Magic Print
    }
    
    foo('hello', 'world');
    

    输出:

    foo('hello','world')
    

    1 回复  |  直到 15 年前
        1
  •  5
  •   Bill Karwin    15 年前

    你可以从 debug_backtrace() .

    function bar(){
      $backtrace = debug_backtrace();
      $t = $backtrace[1];
      print $t["function"] . "('" . implode("','", $t["args"]) . "')\n";
    }
    
    推荐文章