时间:2021-07-01 10:21:17 帮助过:2人阅读
代码如下:
function a() {
}
class b {
public function f() {
}
}
function function_dump($funcname) {
try {
if(is_array($funcname)) {
$func = new ReflectionMethod($funcname[0], $funcname[1]);
$funcname = $funcname[1];
} else {
$func = new ReflectionFunction($funcname);
}
} catch (ReflectionException $e) {
echo $e->getMessage();
return;
}
$start = $func->getStartLine() - 1;
$end = $func->getEndLine() - 1;
$filename = $func->getFileName();
echo "function $funcname defined by $filename($start - $end)\n";
}
function_dump('a');
function_dump(array('b', 'f'));
$b = new b();
function_dump(array($b, 'f'));
?>
http://www.bkjia.com/PHPjc/767086.htmlwww.bkjia.comtruehttp://www.bkjia.com/PHPjc/767086.htmlTechArticle当调试开源的代码时,希望查看某个函数的定义,那么就需要定位其位置。在 zend studio 这样的 IDE 中自是可以自动提示到,但当没有安装这...