php 权限控制器等获取
php 获取文件名(获取控制器,通过读目录的方式)
$planPath = APP_PATH.$modules[$type]['name'].'/controller'; $planList = array(); $dirRes = opendir($planPath); while($dir = readdir($dirRes)) { if(!in_array($dir,array('.','..','.svn'))) { $planList[] = basename($dir,'.php'); } }
thinkphp 获取类对象里的方法名
$control = 'index'; $className = "app\\admin\\controller\\".$control; // ReflectionClass PHP内置函数,不懂的自己查手册 $methods = (new \ReflectionClass($className))->getMethods(\ReflectionMethod::IS_PUBLIC);