php反射应用示例
2023-06-13 09:15:18 时间
<?php
functioncustom(){
}
classcustom{
publicfunctionindex(){
}
}
print_r(get_define_position("custom"));
/**
*/
*@param string$name 函数名或者类名
*@returnarray
*/
functionget_define_position($name){
$info=array();
if(class_exists($name)){
$ob=newReflectionClass($name);
$info["class_".$name]=array("file"=>$ob->getFileName(),"line"=>$ob->getStartLine());
}
if(function_exists($name)){
$ob=newReflectionFunction($name);
$info["function_".$name]=array("file"=>$ob->getFileName(),"line"=>$ob->getStartLine());
}
return$info;
}
相关文章
- php替换字符串中,PHP 替换字符串中的一些字符方法介绍
- php设计模式(三):工厂方法模式 (Factory Method)
- MySQL求和算法在PHP中的应用(mysql求和php)
- PHP与MySQL无缝对接,构建强大数据库应用(php整合mysql)
- 测试Linux下PHP应用的实现(linux测试php)
- PHP与MySQL:搭建你的Web应用(php和mysql)
- PHP命令执行php文件需要注意的问题详解编程语言
- 环境搭建PHP在Linux下的环境搭建与应用(php用linux)
- PHP在Linux下的应用突破之路(php使用linux)
- 让Linux(Debian/Ubuntu、RHEL/CentOS)的nginx(Web服务器)支持PHP
- 监控Redis运行状态:妙用PHP(php监听redis)
- 让Linux帮助启动PHP服务(linux启动php)
- 使用PHP连接MSSQL数据库的实例示范(php连接mssql例子)
- 使用PHP连接Redis应用的指南(redis连接 php)
- 内存Redis自动优化PHP内存管理(redis自动释放php)
- PHP应用Redis缓存带来的变化(redis缓存在php)
- PHP输入流php://input介绍
- 判断php数组是否为索引数组的实现方法
- PHP连接MSSQL2008/2005数据库(SQLSRV)配置实例