/** * 加载控制器 * @param string $filename * @param string $m * @return obj */ private function load_controller($filename = '', $m = '') { if (empty($filename)) { $filename = ROUTE_C; } if (empty($m)) { $m = ROUTE_M; } $filepath = PC_PATH . 'modules' . DIRECTORY_SEPARATOR . $m . DIRECTORY_SEPARATOR . $filename . '.php'; if (file_exists($filepath)) { $classname = $filename; include $filepath; if ($mypath = pc_base::my_path($filepath)) { $classname = 'MY_' . $filename; include $mypath; } if (class_exists($classname)) { return new $classname(); } else { exit('Controller does not exist.'); } } else { exit('Controller does not exist.'); } }
/** * 加载插件控制器 * @param string $filename * @param string $m * @return obj */ private function load_controller($filename = '', $m = '') { if (empty($filename)) $filename = PLUGIN_FILE; if (empty($m)) $m = PLUGIN_ID; $filepath = PC_PATH.'plugin'.DIRECTORY_SEPARATOR.$m.DIRECTORY_SEPARATOR.$filename.'.class.php'; if (file_exists($filepath) && $filename !='plugin_admin') { $classname = $filename; include $filepath; if ($mypath = pc_base::my_path($filepath)) { $classname = 'MY_'.$filename; include $mypath; } return new $classname; } else { exit(L('plugin_error_or_not_exist','','plugin')); } }