php反射應(yīng)用示例
<?php
function custom(){
}
class custom{
public function index(){
}
}
print_r(get_define_position('custom'));
/**
* /
* @param string $name 函數(shù)名或者類名
* @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;
}

相關(guān)文章
PHP實現(xiàn)PDF轉(zhuǎn)圖片的詳細過程(使用imagick)
最近有一份pdf文件,需要將其轉(zhuǎn)換成圖片,所以這篇文章主要給大家介紹了關(guān)于PHP實現(xiàn)PDF轉(zhuǎn)圖片的相關(guān)資料,文中通過示例代碼介紹的非常詳細,需要的朋友可以參考下2023-01-01