复制代码 代码如下:
<?php
function custom(){
}
class custom{
public function index(){
}
}
print_r(get_define_position('custom'));
/**
* /
* @param string $name 函数名或者类名
* @return array
*/
function get_define_position($name){
$info = array();
if(class_exists($name)){
$ob = new reflectionclass($name);
$info['class_'.$name]= array('file'=>$ob->getfilename(),'line'=>$ob->getstartline());
}
if(function_exists($name)){
$ob = new reflectionfunction($name);
$info['function_'.$name]= array('file'=>$ob->getfilename(),'line'=>$ob->getstartline());
}
return $info;
}
【说明】:本文章由站长整理发布,文章内容不代表本站观点,如文中有侵权行为,请与本站客服联系(QQ:)!