Exemplo n.º 1
0
 public function run()
 {
     $uri = Ko_Web_Request::SGet('uri');
     $req_method = Ko_Web_Request::SRequestMethod(true);
     if ('POST' === $req_method) {
         $method = Ko_Web_Request::SPost('method');
         if ('PUT' === $method || 'DELETE' === $method) {
             $req_method = $method;
         }
     }
     $input = 'GET' === $req_method ? $_GET : $_POST;
     unset($input['uri']);
     unset($input['method']);
     if (isset($input['jsondata'])) {
         $input = json_decode($input['jsondata'], true);
     }
     $rest = new KRest_Api();
     $data = $rest->aCall($req_method, $uri, $input);
     $render = new KRender_json();
     $render->oSetData($data)->oSend();
 }
Exemplo n.º 2
0
Arquivo: Rest.php Projeto: AllenLyu/ko
 public function run($ns = '')
 {
     $uri = Ko_Web_Request::SGet('uri');
     $req_method = Ko_Web_Request::SRequestMethod(true);
     if ('POST' === $req_method) {
         $method = Ko_Web_Request::SPost('method');
         if ('PUT' === $method || 'DELETE' === $method) {
             $req_method = $method;
         }
     }
     $input = 'GET' === $req_method ? $_GET : $_POST;
     unset($input['uri']);
     unset($input['method']);
     if (isset($input['jsondata'])) {
         $input = json_decode($input['jsondata'], true);
     }
     $uri = substr($ns, strlen(KO_APPS_NS) + 1) . '/' . $uri;
     $rest = new self();
     $data = $rest->aCall($req_method, $uri, $input);
     $render = new Ko_View_Render_JSON();
     $render->oSetData($data)->oSend();
 }