<?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;
}
您可能感兴趣的文章:
如您对本文有疑问或者有任何想说的,请点击进行留言回复,万千网友为您解惑!
网友评论