请问,PHP里如何获取一个函数是被哪个函数调用的?
例如:
function a(){
c();
}
function b(){
c();
}
function c(){
}
调用:b();,请问我在c()里面要用什么函数或方法来获得调用者是b函数注:在c()函数传调用者函数名称的方式不是我想要的。
高手请指教...
例如:
function a(){
c();
}
function b(){
c();
}
function c(){
}
调用:b();,请问我在c()里面要用什么函数或方法来获得调用者是b函数注:在c()函数传调用者函数名称的方式不是我想要的。
高手请指教...
解决方案 »
- 50分求这样一个正则,请问能实现吗?
- 使用file函数的问题
- 在unix下怎么配置php 4.3.10+mysql 3.23.49+apache1.3.33环境
- 如何把等录PHP网站后用户的session变量传递到asp.net页面,急需解决方法,给50
- 请问如何向一个页面POST一条字符串,并获取返回值?
- HELP~~~~~ HELP~~~~~~~~~
- 数量为什么不能传到修改的页面去呢??help me~~~~~````
- 关于页面现实的问题,急……
- 背景图片随div的大小而改变其大小
- php 函数file_get_contents无法完整抓取网页内容
- 求一个生日时自动发送邮件的代码
- 初学PHP请教
ps:lz是要实现什么啊,传参不符合需求么?
b();
}function b() {
$backtrace = debug_backtrace();
array_shift($backtrace);
var_dump($backtrace);
}a();
http://www.php.net/manual/en/function.debug-backtrace.php
=========================================================
Example #1 debug_backtrace() example<?php
// filename: /tmp/a.phpfunction a_test($str)
{
echo "\nHi: $str";
var_dump(debug_backtrace());
}a_test('friend');
?><?php
// filename: /tmp/b.php
include_once '/tmp/a.php';
?>
Results similar to the following when executing /tmp/b.php: Hi: friend
array(2) {
[0]=>
array(4) {
["file"] => string(10) "/tmp/a.php"
["line"] => int(10)
["function"] => string(6) "a_test" <= 这里
["args"]=>
array(1) {
[0] => &string(6) "friend"
}
}
[1]=>
array(4) {
["file"] => string(10) "/tmp/b.php"
["line"] => int(2)
["args"] =>
array(1) {
[0] => string(10) "/tmp/a.php"
}
["function"] => string(12) "include_once"
}
}