1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889 |
- <?php
- define('BASE_ROOT_PATH',str_replace('\\','/',dirname(__FILE__)));
- define('MOBILE_SERVER',true);
- require_once (BASE_ROOT_PATH . '/fooder.php');
- require_once (BASE_ROOT_PATH . '/helper/http_header.php');
- require_once (BASE_ROOT_PATH . '/helper/session.php');
- require_once (BASE_ROOT_PATH . '/helper/func.php');
- require_once (BASE_ROOT_PATH . '/helper/exceptionex.php');
- require_once (BASE_ROOT_PATH . '/helper/fcgi_server.php');
- function pays_execute($file)
- {
- static $exfiles = array('wxnotify.php','alipay_notify_url.php','dispatch_notify.php','test.php');
- $name = basename($file);
- return in_array($name,$exfiles);
- }
- function run_fcgi()
- {
- require_once(BASE_ROOT_PATH.'/mobile/index.php');
- Base::mobile_init();
- while(($ret = fcgi_accept()) >= 0)
- {
- ob_start();
- $timestamp = time();
- $startime = microtime(true);
- define('StartTime',$startime);
- define('TIMESTAMP',$timestamp);
- http_header::instance()->start();
- try
- {
- init_request();
- init_cookie($_SERVER['HTTP_COOKIE']);
- session::instance()->start();
- Log::record(request_helper::req_uri(),Log::DEBUG);
- $file = request_helper::script_file();
- if(file_exists($file))
- {
- if(pays_execute($file)) {
- include $file;
- } else {
- fcgi_header("Content-Type: text/html; charset=UTF-8");
- Base::mobile_control();
- }
- }
- else
- {
- fcgi_header("Content-Type: text/html; charset=UTF-8");
- echo "no such file.";
- }
- }
- catch (TypeException $ex) {
- joutput_error($ex->getCode(),$ex->getMessage());
- }
- catch (Exception $ex) {
- joutput_error($ex->getCode(),$ex->getMessage().'@@@@@'.$ex->getTraceAsString());
- }
- fcgi_headers_sent();
- $contents = ob_get_clean();
- fcgi_echo($contents);
- Log::record("use time = " . ($startime - microtime(true)),Log::DEBUG);
- session::instance()->end();
- fcgi_finish();
- }
- fcgi_fini();
- }
- function run_srver()
- {
- fcgi_server::instance()->run_looper();
- }
- run_srver();
- ?>
|