123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384 |
- <?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');
- 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();
- $_SESSION['name'] = 'stanley';
- 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.";
- }
- fcgi_setcookie("myname",'stanley');
- session::instance()->end();
- } catch (Exception $ex) {
- joutput_error($ex->getCode(),$ex->getMessage().'@@@@@'.$ex->getTraceAsString());
- }
- fcgi_headers_sent();
- $contents = ob_get_clean();
- fcgi_echo($contents);
- Log::record($contents,Log::DEBUG);
- fcgi_finish();
- }
- fcgi_fini();
- }
- run_fcgi();
- ?>
|