當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Dialog::RequestRuntimeErrorOnCompilingCode方法代碼示例

本文整理匯總了PHP中Dialog::RequestRuntimeErrorOnCompilingCode方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dialog::RequestRuntimeErrorOnCompilingCode方法的具體用法?PHP Dialog::RequestRuntimeErrorOnCompilingCode怎麽用?PHP Dialog::RequestRuntimeErrorOnCompilingCode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Dialog的用法示例。


在下文中一共展示了Dialog::RequestRuntimeErrorOnCompilingCode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: InvokeMethod

 /**
  * Invokes the class method stored on database
  * @param $Request The request object
  * @return void
  */
 private static function InvokeMethod($Request)
 {
     //Check if the class exist in a file inside the controllers folder
     //Note the class_name must be same has the file name to prevent security issues
     $FileDirectory = dirname(dirname(__FILE__)) . "/controllers/" . $Request->Get->class_name . ".php";
     if (file_exists($FileDirectory)) {
         require_once $FileDirectory;
         if (method_exists($Request->Get->class_name, $Request->Get->function_name)) {
             call_user_func(array($Request->Get->class_name, $Request->Get->function_name));
         } else {
             Logger::Error("Request error: The requested function doesn't exist. Requested class_name:" . $Request->Get->class_name . " - function_name:" . $Request->Get->function_name);
             Dialog::RequestClassOrMethodNotExist();
         }
     } else {
         $class = json_decode(json_encode(SystemQueries::GetClass($Request->Get->class_name)));
         if (count($class) === 0) {
             Logger::Error("Request error: The requested class_name doesn't exist. Requested class_name:" . $Request->Get->class_name . " - function_name:" . $Request->Get->function_name);
             Dialog::RequestClassOrMethodNotExist();
         } else {
             if (is_callable(array($class->class_name, $Request->Get->function_name), true)) {
                 try {
                     eval("?>" . $class->class_code);
                     if (method_exists($class->class_name, $Request->Get->function_name)) {
                         call_user_func(array($class->class_name, $Request->Get->function_name));
                     } else {
                         Logger::Error("Request error: The requested function doesn't exist. Requested class_name:" . $Request->Get->class_name . " - function_name:" . $Request->Get->function_name);
                         Dialog::RequestClassOrMethodNotExist();
                     }
                 } catch (Exception $e) {
                     Logger::Error("Request error: The class code could not be interpreted at runtime. Please check that your code is free of errors. Requested class_name:" . $Request->Get->class_name . " - function_name:" . $Request->Get->function_name);
                     Dialog::RequestRuntimeErrorOnCompilingCode();
                 }
             } else {
                 Logger::Error("Request error: The requested function name can't be used to call a method. Requested class_name:" . $Request->Get->class_name . " - function_name:" . $Request->Get->function_name);
                 Dialog::RequestClassOrMethodNotExist();
             }
         }
     }
 }
開發者ID:arivera12,項目名稱:lazy,代碼行數:44,代碼來源:requestmanager.php


注:本文中的Dialog::RequestRuntimeErrorOnCompilingCode方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。