本文整理汇总了PHP中ob_implicit_flush函数的典型用法代码示例。如果您正苦于以下问题:PHP ob_implicit_flush函数的具体用法?PHP ob_implicit_flush怎么用?PHP ob_implicit_flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ob_implicit_flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __construct
function __construct($mode = null)
{
ob_start();
ob_implicit_flush(false);
parent::__construct();
$this->isCli = 'cli' == ($mode ? $mode : PHP_SAPI);
$basedir = $this->isCli ? dirname(realpath($_SERVER['argv'][0])) : $_SERVER['DOCUMENT_ROOT'];
set_include_path($basedir . PATH_SEPARATOR . get_include_path());
$this->config = new Config($this);
$this->config->load(__DIR__ . DIRECTORY_SEPARATOR . 'defaults.php');
if ($configFile = getenv('CONFIG_FILE')) {
$this->config->load($configFile, false);
} else {
$this->config->load('configs.php', true);
}
$this->config->basedir = $basedir;
$on_exception = function ($exception) {
if (!$this->emit('exception', $exception)) {
throw $exception;
}
};
set_exception_handler($on_exception->bindTo($this));
$on_shutdown = function () {
$this->emit('shutdown');
};
register_shutdown_function($on_shutdown->bindTo($this));
$on_error = function (...$args) {
return $this->emit('error', (object) array_combine(['no', 'str', 'file', 'line', 'context'], $args));
};
set_error_handler($on_error->bindTo($this));
$this->useMiddleware($this->config->use);
}
示例2: run
public function run()
{
/*
* Instead of manually rendering scripts after this function returns we
* use the callback. This ensures that scripts are always rendered, even
* if we call exit at some point in the code. (Which we shouldn't, but
* it happens.)
*/
// Ensure to set some var, but script are replaced in SurveyRuntimeHelper
$aLSJavascriptVar = array();
$aLSJavascriptVar['bFixNumAuto'] = (int) (bool) Yii::app()->getConfig('bFixNumAuto', 1);
$aLSJavascriptVar['bNumRealValue'] = (int) (bool) Yii::app()->getConfig('bNumRealValue', 0);
$aLangData = getLanguageData();
$aRadix = getRadixPointData($aLangData[Yii::app()->getConfig('defaultlang')]['radixpoint']);
$aLSJavascriptVar['sLEMradix'] = $aRadix['separator'];
$sLSJavascriptVar = "LSvar=" . json_encode($aLSJavascriptVar) . ';';
App()->clientScript->registerScript('sLSJavascriptVar', $sLSJavascriptVar, CClientScript::POS_HEAD);
App()->clientScript->registerScript('setJsVar', "setJsVar();", CClientScript::POS_BEGIN);
// Ensure all js var is set before rendering the page (User can click before $.ready)
App()->getClientScript()->registerPackage('jqueryui');
App()->getClientScript()->registerPackage('jquery-touch-punch');
App()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "survey_runtime.js");
useFirebug();
ob_start(function ($buffer, $phase) {
App()->getClientScript()->render($buffer);
App()->getClientScript()->reset();
return $buffer;
});
ob_implicit_flush(false);
$this->action();
ob_flush();
}
示例3: renderFile
/**
+----------------------------------------------------------
* 渲染模板输出 供render方法内部调用
+----------------------------------------------------------
* @access public
+----------------------------------------------------------
* @param string $templateFile 模板文件
* @param mixed $var 模板变量
* @param string $charset 模板编码
+----------------------------------------------------------
* @return string
+----------------------------------------------------------
*/
protected function renderFile($templateFile = '', $var = '', $charset = 'utf-8')
{
ob_start();
ob_implicit_flush(0);
if (!file_exists_case($templateFile)) {
// 自动定位模板文件
$name = substr(get_class($this), 0, -6);
$filename = empty($templateFile) ? $name : $templateFile;
$templateFile = LIB_PATH . 'Widget/' . $name . '/' . $filename . C('TMPL_TEMPLATE_SUFFIX');
if (!file_exists_case($templateFile)) {
throw_exception(L('_TEMPLATE_NOT_EXIST_') . '[' . $templateFile . ']');
}
}
$template = $this->template ? $this->template : strtolower(C('TMPL_ENGINE_TYPE') ? C('TMPL_ENGINE_TYPE') : 'php');
if ('php' == $template) {
// 使用PHP模板
if (!empty($var)) {
extract($var, EXTR_OVERWRITE);
}
// 直接载入PHP模板
include $templateFile;
} else {
$className = 'Template' . ucwords($template);
require_cache(THINK_PATH . '/Lib/Think/Util/Template/' . $className . '.class.php');
$tpl = new $className();
$tpl->fetch($templateFile, $var, $charset);
}
$content = ob_get_clean();
return $content;
}
示例4: __construct
public function __construct(Base\Provider $requestProvider, Manager $threadManager)
{
set_time_limit(0);
ob_implicit_flush();
$this->_requestProvider = $requestProvider;
$this->_threadManager = $threadManager;
}
示例5: connect
public function connect(Application $app)
{
$controllers = new ControllerCollection();
$supervisor = new API();
$servers = (include __DIR__ . '/../../config.php');
foreach (array_keys($servers) as $server_id) {
$servers[$server_id]['id'] = $server_id;
}
$controllers->get('/list.{_format}', function ($_format) use($supervisor, $app, $servers) {
if ($_format == 'json') {
return $app->json($servers);
} else {
// use a closure to avoid leaking any vars into the template that we don't explicitly want
return call_user_func(function () use($app) {
$url_root = $app['url_generator']->generate('home');
ob_start();
ob_implicit_flush(false);
include __DIR__ . '/../../views/supervisorui.html.php';
return ob_get_clean();
});
}
})->bind('server_list')->value('_format', 'html');
$controllers->get('/details/{server_id}', function ($server_id) use($supervisor, $app, $servers) {
$server_ip = $servers[$server_id]['ip'];
$details = array_merge(array('version' => $supervisor->getSupervisorVersion('127.0.0.1'), 'pid' => $supervisor->getPID('127.0.0.1')), $supervisor->getState('127.0.0.1'), $servers[$server_id]);
return $app->json($details);
});
return $controllers;
}
示例6: __construct
/**
* Constructor.
*
* @param object &$subject The object to observe
* @param array $config An array that holds the plugin configuration
*
* @since 1.5
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// Log the deprecated API.
if ($this->params->get('log-deprecated')) {
JLog::addLogger(array('text_file' => 'deprecated.php'), JLog::ALL, array('deprecated'));
}
$this->debugLang = JFactory::getApplication()->getCfg('debug_lang');
// Only if debugging or language debug is enabled
if (JDEBUG || $this->debugLang) {
JFactory::getConfig()->set('gzip', 0);
ob_start();
ob_implicit_flush(false);
}
$this->linkFormat = ini_get('xdebug.file_link_format');
if ($this->params->get('logs', 1)) {
$priority = 0;
foreach ($this->params->get('log_priorities', array()) as $p) {
$const = 'JLog::' . strtoupper($p);
if (!defined($const)) {
continue;
}
$priority |= constant($const);
}
// Split into an array at any character other than alphabet, numbers, _, ., or -
$categories = array_filter(preg_split('/[^A-Z0-9_\\.-]/i', $this->params->get('log_categories', '')));
$mode = $this->params->get('log_category_mode', 0);
JLog::addLogger(array('logger' => 'callback', 'callback' => array($this, 'logger')), $priority, $categories, $mode);
}
// Prepare disconnect-handler for SQL profiling:
$db = JFactory::getDbo();
$db->addDisconnectHandler(array($this, 'mysqlDisconnectHandler'));
}
示例7: renderRow
/**
*
* @param biz\models\GlDetail $model
* @param integer $index
* @return string
*/
function renderRow($model, $index)
{
ob_start();
ob_implicit_flush(false);
?>
<tr>
<?php
echo Html::activeHiddenInput($model, "[{$index}]id_gl_detail");
?>
<td class="serial"><?php
echo $index;
?>
</td>
<td><?php
echo Html::activeTextInput($model, "[{$index}]id_coa");
?>
</td>
<td><?php
echo Html::activeTextInput($model, "[{$index}]debit");
?>
</td>
<td><?php
echo Html::activeTextInput($model, "[{$index}]kredit");
?>
</td>
<td class="action"><a class="fa fa-minus-square-o" href="#"></a></td>
</tr>
<?php
return trim(preg_replace('/>\\s+</', '><', ob_get_clean()));
}
示例8: init
/**
* Executes the widget.
*/
public function init()
{
parent::init();
$this->initOptions();
ob_start();
ob_implicit_flush(false);
}
示例9: load
public function load()
{
ob_start();
ob_implicit_flush(false);
include __DIR__ . '/data/admin.php';
ob_get_clean();
}
示例10: pre_start
/**
* Use to begin a preformatted code block.
*
* By default creates <pre class="code">.
*
* @return
* @param object $cssClass[optional]
*/
function pre_start($cssClass = 'code')
{
echo '<pre class="' . $cssClass . "\">\n";
coreConfig::set('pre_highlight_mode', $cssClass);
ob_start();
ob_implicit_flush(0);
}
示例11: generatePrologDTDtyping
function generatePrologDTDtyping($dtd)
{
$table = "dtdFile";
include_once realpath('') . '/includes/configuration/core_configuration.php';
//Load the pear library
require_once 'XML_DTD/DTD.php';
ob_implicit_flush(true);
$path = ini_get('include_path');
$dtd = 'w3cDtds/' . $dtd;
ini_set('include_path', realpath('..') . ":{$path}");
$formElements = array();
$formElements[0] = 'select';
$formElements[1] = 'option';
$formElements[2] = 'textarea';
$formElements[3] = 'input';
$typeRulesArray = array(":- multifile attributetype/3.\n\n");
for ($index = 0; $index < sizeof($formElements); $index++) {
$typeRule = dtd::findAttributes($formElements[$index], $dtd);
$typeRulesArray = array_merge($typeRulesArray, $typeRule->toArray());
}
for ($index = 0; $index < sizeof($typeRulesArray); $index++) {
echo "{$typeRulesArray[$index]}<br>";
}
writer::write('typedefinitions.pl', 'cgi-bin/htmlTyping/', $typeRulesArray);
}
示例12: init
public function init()
{
if ($this->visible) {
ob_start();
ob_implicit_flush(false);
$cs = Yii::app()->clientScript;
if ($this->cssFile === null) {
$cssFile = CHtml::asset(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'assets' . DIRECTORY_SEPARATOR . 'portlet.css');
$cs->registerCssFile($cssFile);
} else {
if ($this->cssFile !== false) {
$cs->registerCssFile($this->cssFile);
}
}
echo "<div class=\"{$this->cssClass}\" style=\"width:{$this->width}\">\n";
if ($this->headerimage !== null) {
echo "<div class=\"{$this->headerCssClass}\"><img src=\"";
}
echo XHtml::imageUrl($this->headerimage);
echo "\"></div>\n";
echo "<div class=\"{$this->contentCssClass}\">\n";
$this->_openTag = ob_get_contents();
ob_clean();
}
}
示例13: response
public function response()
{
if (function_exists('apache_setenv')) {
@apache_setenv('no-gzip', 1);
}
@ini_set('zlib.output_compression', 0);
@ini_set('implicit_flush', 1);
for ($i = 0; $i < ob_get_level(); $i++) {
ob_end_clean();
}
ob_implicit_flush(1);
header('Content-Type: ' . (isset($_GET['callback']) ? 'text/javascript' : 'application/json'));
header('Access-Control-Allow-Origin: *');
try {
if ($this->auth()) {
$this->handler = new RestHandler($this->method, $this);
$response = $this->handler->response();
echo $this->formatResponse($response);
} else {
throw new RestException(RestException::APP_NOT_AUTHORIZED);
}
} catch (RestException $e) {
echo $this->formatResponse($e);
}
@ob_flush();
@flush();
}
示例14: __construct
/**
* Constructor.
*
* @param object &$subject The object to observe
* @param array $config An array that holds the plugin configuration
*
* @since 1.5
*/
public function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// Log the deprecated API.
if ($this->params->get('log-deprecated')) {
\JLog::addLogger(array('text_file' => 'deprecated.php'), \JLog::ALL, array('deprecated'));
}
// Log database errors
if ($this->params->get('log-database-errors')) {
\JLog::addLogger(array('text_file' => 'jdatabase.error.php'), \JLog::ALL, array('database'));
}
// Log database queries
if ($this->params->get('log-database-queries')) {
\JLog::addLogger(array('text_file' => 'jdatabase.query.php'), \JLog::ALL, array('databasequery'));
// Register the HUBzero database logger as well
// Don't worry, this won't log things twice...queries through joomla's database driver
// will get logged above, and this will catch queries through hubzero's database driver
\Event::listen(function ($event) {
\Hubzero\Database\Log::add($event->getArgument('query'), $event->getArgument('time'));
}, 'database_query');
}
// Only if debugging or language debug is enabled
if (Config::get('debug') || Config::get('debug_lang')) {
Config::set('gzip', 0);
ob_start();
ob_implicit_flush(false);
}
$this->linkFormat = ini_get('xdebug.file_link_format');
}
示例15: catch_output
function catch_output(callable $callback)
{
ob_start();
ob_implicit_flush(false);
call_user_func($callback);
return ob_get_clean();
}