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


PHP Gateway::print_test_form方法代碼示例

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


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

示例1: handle_request

 public static function handle_request()
 {
     global $g_error_log;
     global $config;
     /* handle debug test mode; ?io=test */
     $debug = false;
     if (isset($_REQUEST['debug']) && $_REQUEST['debug'] == true) {
         $debug = true;
     }
     if (!$config->debug && $debug) {
         Util::respond_with_http_error(403, 'Forbidden');
     }
     if ($_REQUEST['io'] == 'test') {
         $debug = true;
         if (!$config->debug && $debug) {
             Util::respond_with_http_error(403, 'Forbidden');
         }
         Gateway::print_test_form('');
         exit;
     }
     /* normal processing of AJAX request */
     Util::response_is_ajax_only();
     /* log errors with custom handler and process at conclusion of request */
     //set_error_handler(array('Gateway', 'custom_error_handler'));
     /* in testing, it may be useful to be able to submit a request in this way */
     if (isset($_REQUEST['request'])) {
         $inbound = $_REQUEST['request'];
     } else {
         $inbound = '';
     }
     /* invoke the method as specified in the cmd field of the request */
     $outbound = array();
     try {
         if ($inbound != '') {
             $inbound = json_decode($inbound, true);
         } else {
             $inbound = json_decode(@file_get_contents('php://input'), true);
         }
         if ($inbound === null) {
             CinsImpError::malformed('JSON input malformed');
         }
         $outbound['cmd'] = $inbound['cmd'];
         try {
             $action_method = new ReflectionMethod('Gateway', $inbound['cmd']);
         } catch (Exception $err) {
             throw new Exception("Gateway: Command " . $inbound['cmd'] . " unrecognised.");
         }
         $outbound = $action_method->invoke(null, $inbound, $outbound);
     } catch (Exception $err) {
         $err = new CinsImpError($err);
         $outbound = array();
         $outbound['cmd'] = 'error';
         $outbound['msg'] = 'Server: ' . $err->getMessage() . ': ' . $err->getDetail();
         $outbound['cde'] = $err->getID();
     }
     /* if we're debugging the gateway, output the response on the test form,
     		otherwise send a standard JSON response */
     if ($debug) {
         Gateway::print_test_form(json_encode($outbound, JSON_PRETTY_PRINT));
     } else {
         header('Content-type: application/json');
         print json_encode($outbound);
     }
 }
開發者ID:jhawcroft,項目名稱:cinsimp-web,代碼行數:64,代碼來源:gateway.php


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