当前位置: 首页>>代码示例>>PHP>>正文


PHP fastcgi_finish_request函数代码示例

本文整理汇总了PHP中fastcgi_finish_request函数的典型用法代码示例。如果您正苦于以下问题:PHP fastcgi_finish_request函数的具体用法?PHP fastcgi_finish_request怎么用?PHP fastcgi_finish_request使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了fastcgi_finish_request函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _start

 static function _start()
 {
     if (self::_flushOutputBuffers()) {
         if (function_exists('fastcgi_finish_request')) {
             fastcgi_finish_request();
         } else {
             flush();
         }
     }
     ob_start(self::$class . '_checkOutputBuffer');
     self::register(self::$class . '_end');
 }
开发者ID:nicolas-grekas,项目名称:Patchwork,代码行数:12,代码来源:ShutdownHandler.php

示例2: stop

 function stop()
 {
     if (function_exists('fastcgi_finish_request')) {
         fastcgi_finish_request();
     }
     $last_error = error_get_last();
     if (is_array($last_error)) {
         call_user_func_array(array(PHPIO::$hooks['Error'], '_error_handler'), $last_error);
     }
     ini_set("aop.enable", "0");
     $this->start = false;
 }
开发者ID:sysuyc,项目名称:phpio,代码行数:12,代码来源:Log.php

示例3: start

 public function start($option = [])
 {
     if ($this->session instanceof Session) {
         $this->session->start();
     }
     $jobs = [];
     try {
         $option['job'] = function ($job) use(&$jobs) {
             $jobs[] = $job;
         };
         $this->main($option);
     } catch (Redirect $e) {
         $this->response->redirect($e->getLocation(), $e->getCode());
     } catch (Error $e) {
         $this->respondError($e);
     } catch (\Exception $e) {
         $this->respondError(new Error(500, [], $e));
     } finally {
         if ($this->session instanceof Session) {
             $this->session->clear();
             $this->session->writeClose();
         }
     }
     flush();
     if (function_exists('fastcgi_finish_request')) {
         fastcgi_finish_request();
     }
     foreach ($jobs as $job) {
         $job();
     }
 }
开发者ID:noframework,项目名称:noframework,代码行数:31,代码来源:Application.php

示例4: log_error

function log_error($param)
{
    $logdir = APP_ROOT . APP_DIR . '/webroot/data/logs/';
    if (!is_dir($logdir)) {
        return;
    }
    $error = error_get_last();
    function_exists('fastcgi_finish_request') && fastcgi_finish_request();
    if (!is_array($error) || !in_array($error['type'], array(E_ERROR, E_COMPILE_ERROR, E_CORE_ERROR, E_USER_ERROR, E_RECOVERABLE_ERROR))) {
        return;
    }
    $error = '';
    $error .= date('Y-m-d H:i:s') . '--';
    //$error .= 'Type:' . $error['type'] . '--';
    $error .= 'Msg:' . $error['message'] . '--';
    $error .= 'File:' . $error['file'] . '--';
    $error .= 'Line:' . $error['line'] . '--';
    $error .= 'Ip:' . (isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '0.0.0.0') . '--';
    $error .= 'Uri:' . (isset($_SERVER['REQUEST_URI']) ? $_SERVER['REQUEST_URI'] : '') . '--';
    $error .= empty($_SERVER['CONTENT_TYPE']) ? '' : 'Content-Type:' . $_SERVER['CONTENT_TYPE'] . '--';
    $error .= $_SERVER['REQUEST_METHOD'] . $_SERVER['REQUEST_URI'];
    $error .= '<br/>';
    $size = file_exists($file) ? @filesize($file) : 0;
    file_put_contents($logdir . $param['file'], $error, $size < $param['maxsize'] ? FILE_APPEND : null);
}
开发者ID:justlikeheaven,项目名称:buxun,代码行数:25,代码来源:log.php

示例5: send

 public function send()
 {
     Hook::triggerAction('response.before_send', array(&$this));
     $this->sendHeaders();
     $this->sendContent();
     if (function_exists('fastcgi_finish_request')) {
         fastcgi_finish_request();
     } elseif ('cli' !== PHP_SAPI) {
         // ob_get_level() never returns 0 on some Windows configurations, so if
         // the level is the same two times in a row, the loop should be stopped.
         $previous = null;
         $obStatus = ob_get_status(1);
         while (($level = ob_get_level()) > 0 && $level !== $previous) {
             $previous = $level;
             if ($obStatus[$level - 1]) {
                 if (version_compare(PHP_VERSION, '5.4', '>=')) {
                     if (isset($obStatus[$level - 1]['flags']) && $obStatus[$level - 1]['flags'] & PHP_OUTPUT_HANDLER_REMOVABLE) {
                         ob_end_flush();
                     }
                 } else {
                     if (isset($obStatus[$level - 1]['del']) && $obStatus[$level - 1]['del']) {
                         ob_end_flush();
                     }
                 }
             }
         }
         flush();
     }
     Hook::triggerAction('response.after_send', array(&$this));
     return $this;
 }
开发者ID:wave-framework,项目名称:wave,代码行数:31,代码来源:Response.php

示例6: startExecution

 public function startExecution(Executable $manager)
 {
     if (function_exists('fastcgi_finish_request')) {
         fastcgi_finish_request();
     }
     parent::startExecution($manager);
 }
开发者ID:lstrojny,项目名称:procrastinator,代码行数:7,代码来源:PhpFpmExecutorDecorator.php

示例7: call

 /**
  * Call
  */
 public function call()
 {
     $this->next->call();
     //Fetch status, header, and body
     list($status, $headers, $body) = $this->app->response->result();
     //Send headers
     if (headers_sent() === false) {
         if ('cli' == $this->app->sapi_type) {
             header(sprintf('Status: %s', $status));
         } else {
             header(sprintf('HTTP/%s %s', '1.1', $status));
         }
         foreach ($headers as $name => $value) {
             $hValues = explode("\n", $value);
             foreach ($hValues as $hVal) {
                 header("{$name}: {$hVal}", false);
             }
         }
     }
     echo $this->app->view->format($body);
     //fastcgi
     if (function_exists('fastcgi_finish_request')) {
         fastcgi_finish_request();
     }
     $module = $this->app->module;
     if ($module && method_exists($module, 'asyncJob')) {
         $module->asyncJob();
     }
 }
开发者ID:WickyLeo,项目名称:bobcat,代码行数:32,代码来源:PrettyResultHandler.class.php

示例8: install_shutdown

 /**
  * Single shot defer handeler install
  */
 protected static function install_shutdown()
 {
     if (static::$inited_shutdown) {
         return;
     }
     // Disable time limit
     set_time_limit(0);
     // HHVM support
     if (function_exists('register_postsend_function')) {
         register_postsend_function(function () {
             Event::trigger('core.shutdown');
         });
     } else {
         if (function_exists('fastcgi_finish_request')) {
             register_shutdown_function(function () {
                 fastcgi_finish_request();
                 Event::trigger('core.shutdown');
             });
         } else {
             register_shutdown_function(function () {
                 Event::trigger('core.shutdown');
             });
         }
     }
     static::$inited_shutdown = true;
 }
开发者ID:caffeina-core,项目名称:core,代码行数:29,代码来源:Work.php

示例9: handleRequest

 public function handleRequest()
 {
     ini_set('display_errors', '0');
     $as = new \FutoIn\RI\ScopedSteps();
     $as->add(function ($as) {
         $reqinfo = $this->getBaseRequestInfo($as);
         $this->configureRequestInfo($as, $reqinfo);
         $as->reqinfo = $reqinfo;
         $this->process($as);
         $as->add(function ($as) {
             $reqinfo = $as->reqinfo;
             $reqinfo_info = $reqinfo->info();
             if (!is_null($reqinfo_info->{RequestInfo::INFO_RAW_RESPONSE})) {
                 header('Content-Type: application/futoin+json');
                 echo $reqinfo_info->{RequestInfo::INFO_RAW_RESPONSE};
             }
             if (function_exists('fastcgi_finish_request')) {
                 fastcgi_finish_request();
             }
             $as->success();
         });
     }, function ($as, $err) {
         error_log("{$err}: " . $as->error_info);
         http_response_code(500);
         header('Content-Type: application/futoin+json');
         echo '{"e":"InvalidRequest"}';
     });
     $as->run();
 }
开发者ID:futoin,项目名称:core-php-ri-executor,代码行数:29,代码来源:Executor.php

示例10: generateAndMatchMidi

 public function generateAndMatchMidi(Request $request)
 {
     echo 'true';
     // =======这部分是将输出内容刷新到用户浏览器并断开和浏览器的连接=====
     // 如果使用的是php-fpm
     if (function_exists('fastcgi_finish_request')) {
         // 刷新buffer
         ob_flush();
         flush();
         // 断开浏览器连接
         fastcgi_finish_request();
     }
     // ========下面是后台要继续执行的内容========
     // 查看midi是否已经存在
     $midi_exists = self::midiExists($request);
     Log::info('[查询 midi是否生成] ' . $midi_exists);
     // 若midi不存在,执行wav转midi, 否则执行匹配midi
     if ($midi_exists == 'false') {
         Log::info('[转换 midi] ' . $request->uid . '/' . $request->pid . '/' . $request->wav);
         // wav转midi
         $this->midiIsGenerated($request);
     } else {
         Log::info('[匹配 midi] ' . $request->uid . '/' . $request->pid . '/' . $request->wav);
         // 匹配midi
         self::matchMidi($request);
     }
 }
开发者ID:WangWeigao,项目名称:m1,代码行数:27,代码来源:AutoTestController.php

示例11: track

 public function track()
 {
     $url = 'www.google-analytics.com';
     $page = '/collect';
     $googleip = $this->memcacheget('googleip');
     if (empty($googleip)) {
         $googleip = gethostbyname($url);
         $this->memcacheset('googleip', $googleip, 3600);
     }
     //set POST variables
     if (isset($_SERVER['HTTP_CF_CONNECTING_IP'])) {
         $_SERVER['REMOTE_ADDR'] = $_SERVER['HTTP_CF_CONNECTING_IP'];
     }
     $fields = array('v' => '1', 'tid' => $this->GA_ID, 'cid' => $this->gaParseCookie(), 't' => 'pageview', 'cm' => $_GET["api_key"], 'dr' => $this->project_url, 'cs' => $this->project, 'dh' => 'webservice.fanart.tv', 'dp' => $this->ttype . '/' . $this->tid, 'uip' => $_SERVER['REMOTE_ADDR'], 'ua' => $_SERVER['HTTP_USER_AGENT']);
     $fields_string = http_build_query($fields);
     //die($this->myfunc_getIP($url));
     $fp = fsockopen($googleip, 80, $errno, $errstr, 5);
     //$fp = fsockopen($url, 80, $errno, $errstr, 5);
     stream_set_blocking($fp, 0);
     stream_set_timeout($fp, 5);
     $output = "POST http://" . $url . $page . " HTTP/1.1\r\n";
     $output .= "Host: {$url}\r\n";
     $output .= "Content-Length: " . strlen($fields_string) . "\r\n";
     $output .= "Connection: close\r\n\r\n";
     $output .= $fields_string;
     //die($output);
     fastcgi_finish_request();
     $sentData = 0;
     $toBeSentData = strlen($output);
     while ($sentData < $toBeSentData) {
         $sentData += fwrite($fp, $output);
     }
     fclose($fp);
 }
开发者ID:KodeStar,项目名称:pro-api,代码行数:34,代码来源:Rest.php

示例12: xhprof_shutdown

function xhprof_shutdown()
{
    global $xhprofMainConfig;
    $xhprof_data = xhprof_disable();
    if (function_exists('fastcgi_finish_request')) {
        fastcgi_finish_request();
    }
    try {
        require_once __DIR__ . '/../xhprof/classes/data.php';
        $xhprof_data_obj = new \ay\xhprof\Data($xhprofMainConfig['pdo']);
        $xhprof_data_obj->save($xhprof_data);
    } catch (Exception $e) {
        // old php versions don't like Exceptions in shutdown functions
        // -> log them to have some usefull info in the php-log
        if (PHP_VERSION_ID < 504000) {
            if (function_exists('log_exception')) {
                log_exception($e);
            } else {
                error_log($e->__toString());
            }
        }
        // re-throw to show the caller something went wrong
        throw $e;
    }
}
开发者ID:sugarops,项目名称:xhprof.io,代码行数:25,代码来源:prepend.php

示例13: finishExecution

 public static function finishExecution()
 {
     if (function_exists('fastcgi_finish_request')) {
         fastcgi_finish_request();
     } else {
         exit(0);
     }
 }
开发者ID:wake-up-neo,项目名称:php-xframework,代码行数:8,代码来源:SystemExit.php

示例14: fork

 /**
  * Try to create a zombie.
  *
  * @return  bool
  */
 public static function fork()
 {
     if (true !== static::test()) {
         throw new Exception('This program must run behind PHP-FPM to create a zombie.', 0);
     }
     fastcgi_finish_request();
     return true;
 }
开发者ID:Grummfy,项目名称:Central,代码行数:13,代码来源:Zombie.php

示例15: run

 /**
  * 处理器入口
  *
  * @access public static
  * @return void
  */
 public static function run($ini, $url, $post = null)
 {
     $dsp = new self($ini);
     $dsp->dispach($url, $post);
     if (empty($GLOBALS['__in_debug_tools']) && function_exists('fastcgi_finish_request')) {
         fastcgi_finish_request();
     }
 }
开发者ID:ray-dong,项目名称:Myfox-load-module,代码行数:14,代码来源:dispatcher.php


注:本文中的fastcgi_finish_request函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。