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


PHP ob_get_status函数代码示例

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


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

示例1: run

 /**
  * โหลด GCMS เพื่อแสดงผลหน้าเว็บไซต์
  */
 public function run()
 {
     /**
      * inint session
      */
     session_start();
     if (!ob_get_status()) {
         if (extension_loaded('zlib') && !ini_get('zlib.output_compression')) {
             // เปิดใช้งานการบีบอัดหน้าเว็บไซต์
             ob_start('ob_gzhandler');
         } else {
             ob_start();
         }
     }
     /**
      * โหลด GCMS
      */
     $this->inint();
     /**
      * save variable
      */
     setCookie('gcms_language', LANGUAGE, time() + 3600 * 24 * 365);
     /**
      * create Router
      */
     self::createClass('Core\\Router');
     /**
      * return current instance
      */
     return self::$instance;
 }
开发者ID:boyatomic32,项目名称:movie,代码行数:34,代码来源:gcms.php

示例2: wfStreamFile

/** */
function wfStreamFile($fname)
{
    $stat = @stat($fname);
    if (!$stat) {
        header('HTTP/1.0 404 Not Found');
        $encFile = htmlspecialchars($fname);
        $encScript = htmlspecialchars($_SERVER['SCRIPT_NAME']);
        echo "<html><body>\n<h1>File not found</h1>\n<p>Although this PHP script ({$encScript}) exists, the file requested for output \n({$encFile}) does not.</p>\n</body></html>";
        return;
    }
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $stat['mtime']) . ' GMT');
    // Cancel output buffering and gzipping if set
    while ($status = ob_get_status()) {
        ob_end_clean();
        if ($status['name'] == 'ob_gzhandler') {
            header('Content-Encoding:');
        }
    }
    $type = wfGetType($fname);
    if ($type and $type != "unknown/unknown") {
        header("Content-type: {$type}");
    } else {
        header('Content-type: application/x-wiki');
    }
    if (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE'])) {
        $modsince = preg_replace('/;.*$/', '', $_SERVER['HTTP_IF_MODIFIED_SINCE']);
        $sinceTime = strtotime($modsince);
        if ($stat['mtime'] <= $sinceTime) {
            header("HTTP/1.0 304 Not Modified");
            return;
        }
    }
    header('Content-Length: ' . $stat['size']);
    readfile($fname);
}
开发者ID:puring0815,项目名称:OpenKore,代码行数:36,代码来源:StreamFile.php

示例3: getLatandLong

function getLatandLong($addr, $region)
{
    $url = "http://maps.google.com/maps/api/geocode/json?address=" . $addr . "&region=" . $region . "&sensor=false";
    $response = file_get_contents($url);
    if ($response == false) {
        throw new Exception("Failure to obtain data");
    }
    $places = json_decode($response);
    if (!$places) {
        throw new Exception("Invalid JSON response");
    }
    if (is_array($places->results) && count($places->results)) {
        $result = $places->results[0];
        $geometry = $result->{'geometry'};
        $location = $geometry->{'location'};
        $lat = $location->{'lat'};
        $long = $location->{'lng'};
        ob_start();
        // ensures anything dumped out will be caught
        // do stuff here
        //header( "Location: $url" );
        //return $lat.",".$long;
        // clear out the output buffer
        while (ob_get_status()) {
            ob_end_clean();
        }
    } else {
        return "Unknown";
    }
}
开发者ID:jonboy11171,项目名称:twitter-pos-geotagging,代码行数:30,代码来源:GoogleGeoCodeWebService.php

示例4: clean_buffers

 public static function clean_buffers()
 {
     if ($status = ob_get_status()) {
         foreach (range(0, $status['level']) as $lvl) {
             ob_end_clean();
         }
     }
 }
开发者ID:railsphp,项目名称:railsphp,代码行数:8,代码来源:ActionView.php

示例5: flushHigherBuffers

 /**
  * @method flushHigherBuffers
  */
 function flushHigherBuffers()
 {
     $status = ob_get_status(false);
     $level = $status['level'];
     // nesting level of current buffer
     for ($i = $level; $i > $this->level; --$i) {
         @ob_end_flush();
     }
 }
开发者ID:dmitriz,项目名称:Platform,代码行数:12,代码来源:OutputBuffer.php

示例6: displayError

 public function displayError($message)
 {
     if (ob_get_status()["level"] > 0) {
         // Clear the buffer.
         ob_end_clean();
     }
     // Terminate with an error message.
     exit("Error: {$message}.");
 }
开发者ID:ecj2,项目名称:kaku,代码行数:9,代码来源:utility.php

示例7: PMA_outBufferPost

/**
 * This function will need to run at the bottom of all pages if output
 * buffering is turned on.  It also needs to be passed $mode from the
 * PMA_outBufferModeGet() function or it will be useless.
 *
 */
function PMA_outBufferPost()
{
    if (ob_get_status() && PMA_outBufferModeGet()) {
        ob_flush();
    }
    /**
     * previously we had here an "else flush()" but some PHP versions
     * (at least PHP 5.2.11) have a bug (49816) that produces garbled
     * data
     */
}
开发者ID:nicokaiser,项目名称:phpmyadmin,代码行数:17,代码来源:ob.lib.php

示例8: phorum_api_buffer_clear

/**
 * Clear out all output that PHP buffered up to now.
 */
function phorum_api_buffer_clear()
{
    // Clear out all output that PHP buffered up to now.
    for (;;) {
        $status = ob_get_status();
        if (!$status || $status['name'] == 'ob_gzhandler' || !$status['del']) {
            break;
        }
        ob_end_clean();
    }
}
开发者ID:netovs,项目名称:Core,代码行数:14,代码来源:buffer.php

示例9: __construct

 public function __construct($index = null)
 {
     if (defined('DEBUG_ENABLED') && DEBUG_ENABLED && (($fargs = func_get_args()) || ($fargs = 'NOARGS'))) {
         debug_log('Entered (%%)', 129, 0, __FILE__, __LINE__, __METHOD__, $fargs);
     }
     # If we done have a configuration, then our IMGDIR and CSS are not defined
     if (!defined('IMGDIR')) {
         define('IMGDIR', 'images/default');
     }
     if (!defined('CSSDIR')) {
         define('CSSDIR', 'css/default');
     }
     $this->index = $index;
     # To be defined in a configuration file.
     $this->_app['title'] = app_name();
     $this->_app['logo'] = IMGDIR . '/logo-small.png';
     if (!is_null($index)) {
         $this->_app['urlcss'] = sprintf('%s/%s', CSSDIR, $_SESSION[APPCONFIG]->getValue('appearance', 'stylesheet'));
     } else {
         $this->_app['urlcss'] = sprintf('%s/%s', CSSDIR, 'style.css');
     }
     # Default Values for configurable items.
     $this->_default['sysmsg']['error'] = IMGDIR . '/error-big.png';
     $this->_default['sysmsg']['warn'] = IMGDIR . '/warn-big.png';
     $this->_default['sysmsg']['info'] = IMGDIR . '/info-big.png';
     # Capture any output so far (in case we send some headers below) - there shouldnt be any output anyway.
     $preOutput = '';
     # Try and work around if php compression is on, or the user has set compression in the config.
     # type = 1 for user gzip, 0 for php.ini gzip.
     $obStatus = ob_get_status();
     if (isset($obStatus['type']) && $obStatus['type'] && $obStatus['status']) {
         $preOutput = ob_get_contents();
         ob_end_clean();
     }
     header('Content-type: text/html; charset="UTF-8"');
     if (isCompress()) {
         header('Content-Encoding: gzip');
         if (defined('DEBUG_ENABLED') && DEBUG_ENABLED) {
             debug_log('Sent COMPRESSED header to browser and discarded (%s)', 129, 0, __FILE__, __LINE__, __METHOD__, $preOutput);
         }
     }
     if (isset($_SESSION[APPCONFIG]) && $_SESSION[APPCONFIG]->getValue('appearance', 'compress') && ini_get('zlib.output_compression')) {
         $this->setsysmsg(array('title' => _('Warning'), 'body' => _('WARNING: You cannot have PHP compression and application compression enabled at the same time. Please unset zlib.output_compression or set $config->custom->appearance[\'compress\']=false'), 'type' => 'warn'));
     }
     # Turn back on output buffering.
     ob_start();
     # Initial Values
     $this->_pageheader[] .= '<?xml version="1.0" encoding="utf-8"?>' . "\n";
     $this->_pageheader[] .= '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML Basic 1.0//EN"' . "\n";
     $this->_pageheader[] .= '"http://www.w3.org/TR/xhtml-basic/xhtml-basic10.dtd">' . "\n";
     $this->_pageheader[] .= "\n";
     $this->_pageheader[] .= '<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="auto" lang="auto" dir="ltr">' . "\n";
     $this->_pageheader[] .= "\n";
 }
开发者ID:kangaroot,项目名称:phpldapadmin,代码行数:54,代码来源:page.php

示例10: stderr

 /**
  * Writes the message $msg to STDERR.
  *
  * @param string $msg The message to output
  * @param string $status Output status
  *
  * @return \Phrozn\Outputter
  */
 public function stderr($msg, $status = self::STATUS_FAIL)
 {
     if (defined('STDERR')) {
         fwrite(STDERR, $msg);
     } else {
         echo $msg;
         if (count(\ob_get_status()) !== 0) {
             ob_flush();
         }
     }
     return $this;
 }
开发者ID:farazdagi,项目名称:phrozn,代码行数:20,代码来源:PlainOutputter.php

示例11: redirect

 function redirect($url)
 {
     ob_start();
     // ensures anything dumped out will be caught
     // clear out the output buffer
     while (ob_get_status()) {
         ob_end_clean();
     }
     // no redirect
     header("Location: {$url}");
     exit;
 }
开发者ID:Ksarat,项目名称:miritec,代码行数:12,代码来源:siteController.php

示例12: cleanAllBuffers

 /**
  * Clean all existing user buffers
  */
 static function cleanAllBuffers()
 {
     for ($i = 0; $i <= 30; $i++) {
         if (!ob_get_level()) {
             break;
         }
         $status = ob_get_status();
         if ($status && strpos(strtolower($status["name"]), "zlib") === false) {
             ob_end_clean();
         }
     }
 }
开发者ID:nonconforme,项目名称:nreeda,代码行数:15,代码来源:OutputManager.class.php

示例13: closeOutputBuffers

 public static function closeOutputBuffers($targetLevel, $flush)
 {
     $status = ob_get_status(true);
     $level = count($status);
     $flags = defined('PHP_OUTPUT_HANDLER_REMOVABLE') ? PHP_OUTPUT_HANDLER_REMOVABLE | ($flush ? PHP_OUTPUT_HANDLER_FLUSHABLE : PHP_OUTPUT_HANDLER_CLEANABLE) : -1;
     while ($level-- > $targetLevel && ($s = $status[$level]) && (!isset($s['del']) ? !isset($s['flags']) || $flags === ($s['flags'] & $flags) : $s['del'])) {
         if ($flush) {
             ob_end_flush();
         } else {
             ob_end_clean();
         }
     }
 }
开发者ID:johninchina,项目名称:mvc-frame,代码行数:13,代码来源:Response.php

示例14: procesar_facturas

 public function procesar_facturas($valores_id, $archivo = FALSE)
 {
     if (!empty($valores_id)) {
         if (ob_get_status()) {
             ob_end_clean();
         }
         $pdf_doc = new PDF_MC_Table('P', 'mm', 'letter');
         $pdf_doc->SetTitle('Facturas de Venta');
         $pdf_doc->SetSubject('Facturas de Venta para clientes');
         $pdf_doc->SetAuthor($this->empresa->nombre);
         $pdf_doc->SetCreator('FacturaSctipts V_' . $this->version());
         $this->archivo = $archivo;
         $contador = 0;
         $this->factura = FALSE;
         foreach ($valores_id as $id) {
             $factura = new factura_cliente();
             $this->factura = $factura->get($id);
             if ($this->factura) {
                 $ncf_datos = new ncf_ventas();
                 $valores = $ncf_datos->get_ncf($this->empresa->id, $this->factura->idfactura, $this->factura->codcliente, $this->factura->fecha);
                 $ncf_tipo = new ncf_tipo();
                 $tipo_comprobante = $ncf_tipo->get($valores->tipo_comprobante);
                 $this->factura->ncf = $valores->ncf;
                 $this->factura->ncf_afecta = $valores->ncf_modifica;
                 $this->factura->estado = $valores->estado;
                 $this->factura->tipo_comprobante = $tipo_comprobante->descripcion;
                 if ($this->distrib_transporte) {
                     $transporte = $this->distrib_transporte->get($this->empresa->id, $this->factura->idfactura, $this->factura->codalmacen);
                     $this->idtransporte = isset($transporte[0]->idtransporte) ? str_pad($transporte[0]->idtransporte, 10, "0", STR_PAD_LEFT) : false;
                 }
                 $cliente = new cliente();
                 $this->cliente = $cliente->get($this->factura->codcliente);
                 $this->generar_pdf($pdf_doc);
                 $contador++;
             }
         }
         // Damos salida al archivo PDF
         if ($this->archivo) {
             if (!file_exists('tmp/' . FS_TMP_NAME . 'enviar')) {
                 mkdir('tmp/' . FS_TMP_NAME . 'enviar');
             }
             $pdf_doc->Output('tmp/' . FS_TMP_NAME . 'enviar/' . $archivo, 'F');
         } else {
             $pdf_doc->Output();
         }
         if (!$this->factura) {
             $this->new_error_msg("¡Factura de cliente no encontrada!");
         }
     }
 }
开发者ID:joenilson,项目名称:republica_dominicana,代码行数:50,代码来源:factura_ncf.php

示例15: stderr

 /**
  * Writes the message $msg to STDERR.
  *
  * @param string $msg The message to output
  * @param string $status Output status
  *
  * @return Outputter
  */
 public function stderr($msg, $status = self::STATUS_FAIL)
 {
     $msg = "<strong>" . $msg . "</strong>";
     $msg = $this->removeColors($msg);
     $msg = $this->replaceEOLs($msg);
     if (defined('STDERR')) {
         fwrite(STDERR, $msg);
     } else {
         echo $msg;
         if (count(\ob_get_status()) !== 0) {
             ob_flush();
         }
     }
     return $this;
 }
开发者ID:farazdagi,项目名称:phrozn,代码行数:23,代码来源:HtmlOutputter.php


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