window.location = './index.php'; "; return; } } catch (Exception $e) { $errorMessage = $e->getMessage(); } self::view('login.tpl', compact('redirectToHome', 'errorMessage')); } public static function debug() { if (self::_checkGrant()) { self::view(__FUNCTION__ . ".tpl"); } else { self::login(); } } public static function monitor() { if (self::_checkGrant()) { self::view(__FUNCTION__ . ".tpl"); } else { self::login(); } } public static function call() { if (self::_checkGrant()) { $params = loyalsoft\query_paras(); $className = $params['className']; $mname = $params['method']; if ($className && $mname) { include_once __DIR__ . '/../../../App/Services/' . str_replace("loyalsoft\\", "", $className) . '.php'; # 直接向客户端输出返回值 $rt = new RenderTime(); ob_start(); $result = call_user_func_array(array($className, $mname), array_values($_POST)); $content = ob_end_flush(); $rt->end(); if (strlen($content) > 0) { echo("输出: " . $content); } echo "

"; echo("返回值: " . json_encode($result)); echo "

"; echo("耗时:" . $rt->getRenderTime()); } } else { self::login(); } } /** * 查验授权 * @return boolean */ private static function _checkGrant() { // 访问授权控制 $accessManager = new Amfphp_BackOffice_AccessManager(); return $accessManager->isAccessGranted(); } }