Esempio n. 1
0
 protected function onExec()
 {
     if (!isCLI()) {
         if (ApiFw_::$SOLO) {
             header("Content-Type: text/plain; charset=UTF-8");
             #header("Content-Type: application/json; charset=UTF-8");
         }
         header("Cache-Control: no-cache");
     }
     setServerRev();
     $ac = param('_ac', null, $_GET);
     if (!isset($ac)) {
         // 支持PATH_INFO模式。
         @($path = $this->getPathInfo());
         if ($path != null) {
             $ac = $this->parseRestfulUrl($path);
         }
     }
     if (!isset($ac)) {
         $ac = mparam('ac', $_GET);
     }
     Conf::onApiInit();
     dbconn();
     global $DBH;
     if (!isCLI()) {
         session_start();
     }
     $this->apiLog = new ApiLog($ac);
     $this->apiLog->logBefore();
     // API调用监控
     $this->apiWatch = new ApiWatch($ac);
     $this->apiWatch->execute();
     if ($ac == "batch") {
         $useTrans = param("useTrans", false, $_GET);
         $ret = $this->batchCall($useTrans);
     } else {
         $ret = $this->call($ac, true);
     }
     return $ret;
 }