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 curl模擬登錄帶驗(yàn)證碼的網(wǎng)站
最近接了個(gè)項(xiàng)目,其中有需求是要登錄帶驗(yàn)證碼的網(wǎng)站,獲取數(shù)據(jù),但是我們不可能人為的一直去記錄數(shù)據(jù),想通過自動(dòng)采集的方式進(jìn)行,下面小編給大家?guī)?lái)的相關(guān)代碼,對(duì)php curl 模擬登錄帶驗(yàn)證碼的網(wǎng)站感興趣的朋友一起學(xué)習(xí)吧2015-11-11PHP實(shí)現(xiàn)PDF轉(zhuǎn)圖片的詳細(xì)過程(使用imagick)
最近有一份pdf文件,需要將其轉(zhuǎn)換成圖片,所以這篇文章主要給大家介紹了關(guān)于PHP實(shí)現(xiàn)PDF轉(zhuǎn)圖片的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考下2023-01-01php合并數(shù)組并保留鍵值的實(shí)現(xiàn)方法
下面小編就為大家分享一篇php合并數(shù)組并保留鍵值的實(shí)現(xiàn)方法,具有很好的參考價(jià)值,希望對(duì)大家有所幫助。一起跟隨小編過來(lái)看看吧2018-03-03