本文整理汇总了PHP中ob_end_flush函数的典型用法代码示例。如果您正苦于以下问题:PHP ob_end_flush函数的具体用法?PHP ob_end_flush怎么用?PHP ob_end_flush使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ob_end_flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: start
static function start()
{
include_once __DIR__ . '/sessionDrivers/' . Settings::$sessionDriver . '.php';
//self::$driver = new Settings::$sessionDriver();
//session_set_save_handler(array(self::$driver, 'open'),array(self::$driver, 'close'),array(self::$driver, 'read'),
// array(self::$driver, 'write'),array(self::$driver, 'destroy'),array(self::$driver, 'gc'));
register_shutdown_function('session_write_close');
if (in_array(Settings::$session_hash, hash_algos())) {
ini_set('session.hash_function', Settings::$session_hash);
}
ini_set('session.hash_bits_per_character', Settings::$hash_bits_per_character);
$cookieParams = session_get_cookie_params();
session_set_cookie_params(Settings::$sessionLifetime, $cookieParams["path"], $cookieParams["domain"], Settings::$secure, Settings::$httpOnly);
session_name(Settings::$NAME);
//буферизуем заголовок
ob_start();
//включаем CORS, если указано в настройках /*
if (isset(Settings::$CORS) && Settings::$CORS && !empty($_SERVER['HTTP_ORIGIN'])) {
header('Access-Control-Allow-Origin: ' . $_SERVER['HTTP_ORIGIN']);
header('Access-Control-Allow-Methods: GET, PUT, POST, DELETE, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type, Authorization, X-Requested-With');
}
//включаем сессию
session_start();
ob_end_flush();
//посылаем заголовок
}
示例2: render
public function render($template = null, array $arguments = null)
{
if (null === $template) {
return false;
}
$parentTemplate = $this->currentTemplate;
$this->currentTemplate = $this->totalTemplates = $this->totalTemplates + 1;
$path = $this->finder->getPath($template);
if (!is_file($path)) {
throw new \RuntimeException('The requested view file doesn\'t exist in: <strong>' . $path . '</strong>', 404);
}
ob_start();
try {
$this->requireInContext($path, $arguments);
} catch (\Exception $e) {
ob_end_clean();
throw $e;
}
if (isset($this->parent[$this->currentTemplate])) {
$this->data['content'] = ob_get_contents();
ob_end_clean();
$this->render($this->parent[$this->currentTemplate], $arguments);
} else {
ob_end_flush();
}
if ($parentTemplate == 0) {
$this->clean();
} else {
$this->currentTemplate = $parentTemplate;
}
}
示例3: dump_post
function dump_post()
{
global $post;
ob_start('kint_debug_globals');
d($post);
ob_end_flush();
}
示例4: redirect
function redirect($url)
{
ob_start();
header('Location: ' . $url);
ob_end_flush();
die;
}
示例5: viewAction
public function viewAction()
{
// We view a file, so we should disable layout
$this->_helper->layout->disableLayout();
$this->_helper->viewRenderer->setNoRender();
$key = $this->_getParam('key');
$size = $this->_getParam('size');
$inline = $this->_getParam('inline');
if (strpos($key, '.')) {
$key = substr($key, 0, strpos($key, '.'));
}
$files = new Files();
if (!($file = $files->getFileFromKey($key))) {
throw new Stuffpress_Exception("No such file for key {$key}");
}
if ($size == 'thumbnail') {
$folder = '/thumbnails/';
} else {
if ($size == 'small') {
$folder = '/small/';
} else {
if ($size == 'medium') {
$folder = '/medium/';
} else {
if ($size == 'large') {
$folder = '/large/';
} else {
$folder = '/';
}
}
}
}
$root = Zend_Registry::get("root");
$config = Zend_Registry::get("configuration");
if (isset($config) && isset($config->path->upload)) {
$upload = $config->path->upload;
} else {
$upload = $root . "/upload/";
}
$path = $upload . "/{$folder}{$file->key}";
if ($folder != '/' && !file_exists($path)) {
$path = $upload . "/{$file->key}";
}
// Dump the file
if (!$inline) {
header("Content-Disposition: attachment; filename=\"{$file->name}\"");
}
header("Content-type: {$file->type}");
header('Content-Length: ' . filesize($path));
/*$this->getResponse()->setHeader('Expires', '', true);
$this->getResponse()->setHeader('Cache-Control', 'public', true);
$this->getResponse()->setHeader('Cache-Control', 'max-age=3800');
$this->getResponse()->setHeader('Pragma', '', true);*/
// We turn off output buffering to avoid memory issues
// when dumping the file
ob_end_flush();
readfile($path);
// Die to make sure that we don't screw up the file
die;
}
示例6: write
function write($id, $sess_data)
{
ob_start("output_html");
echo "laruence";
ob_end_flush();
return true;
}
示例7: executeDownload
public function executeDownload(sfWebRequest $request)
{
$this->checkProject($request);
$this->checkProfile($request, $this->ei_project);
$this->checkAttachment($request);
//throw new Exception($this->ei_subject_attachment->getPath());
$filePath = sfConfig::get('sf_upload_dir') . '/subjectAttachements/' . $this->ei_subject_attachment->getPath();
//$mimeType = mime_content_type($this->ei_subject_attachment->getPath());
/** @var $response sfWebResponse */
$response = $this->getResponse();
$response->clearHttpHeaders();
//$response->setContentType($mimeType);
$response->setHttpHeader('Content-Disposition', 'attachment; filename="' . $this->ei_subject_attachment->getFileName() . '"');
$response->setHttpHeader('Content-Description', 'File Transfer');
$response->setHttpHeader('Content-Transfer-Encoding', 'binary');
$response->setHttpHeader('Content-Length', filesize($filePath));
$response->setHttpHeader('Cache-Control', 'public, must-revalidate');
// if https then always give a Pragma header like this to overwrite the "pragma: no-cache" header which
// will hint IE8 from caching the file during download and leads to a download error!!!
$response->setHttpHeader('Pragma', 'public');
//$response->setContent(file_get_contents($filePath)); # will produce a memory limit exhausted error
$response->sendHttpHeaders();
ob_end_flush();
return $this->renderText(readfile($filePath));
}
示例8: widget
public function widget($args, $instance)
{
$cache = array();
if (!$this->is_preview()) {
$cache = wp_cache_get($this->cache_key, 'widget');
}
if (!is_array($cache)) {
$cache = array();
}
if (!isset($args['widget_id'])) {
$args['widget_id'] = $this->id;
}
if (isset($cache[$args['widget_id']])) {
echo balanceTags($cache[$args['widget_id']]);
return;
}
ob_start();
$default = array('title' => 'Filter By:', 'show_attribute' => '', 'st_search_fields' => '', 'style' => 'dark');
$instance = wp_parse_args($instance, $default);
echo st()->load_template('rental/filter', null, array('instance' => $instance));
if (!$this->is_preview()) {
$cache[$args['widget_id']] = ob_get_flush();
wp_cache_set($this->cache_key, $cache, 'widget');
} else {
ob_end_flush();
}
}
示例9: print_gzipped_page
function print_gzipped_page()
{
$HTTP_ACCEPT_ENCODING = getenv("HTTP_ACCEPT_ENCODING");
if (headers_sent()) {
$encoding = false;
} elseif (strpos($HTTP_ACCEPT_ENCODING, 'x-gzip') !== false) {
$encoding = 'x-gzip';
} elseif (strpos($HTTP_ACCEPT_ENCODING, 'gzip') !== false) {
$encoding = 'gzip';
} else {
$encoding = false;
}
if ($encoding) {
$contents = ob_get_contents();
ob_end_clean();
header('Content-Encoding: ' . $encoding);
header("ETag: " . md5($contents));
// ETag im Header senden
header("Expires: " . date("r", mktime(0, 0, 0, date("n"), date("j") + 365)));
print "�";
$size = strlen($contents);
$contents = gzcompress($contents, 9);
$contents = substr($contents, 0, $size);
print $contents;
// exit();
} else {
ob_end_flush();
// exit();
}
}
示例10: flush_buffers
function flush_buffers()
{
ob_end_flush();
ob_flush();
flush();
ob_start();
}
示例11: __destruct
/**
* Code ran after the event handler, adds headers etc to the request
* If noHeaders is false, it adds all the correct http/1.1 headers to the request
* and deals with modified/expires/e-tags/etc. This makes the server behave more like
* a real http server.
*/
public function __destruct()
{
if (!$this->noHeaders) {
header("Content-Type: {$this->contentType}" . (!empty($this->charset) ? "; charset={$this->charset}" : ''));
header('Accept-Ranges: bytes');
if ($this->noCache) {
header("Cache-Control: no-cache, must-revalidate", true);
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT", true);
} else {
// attempt at some propper header handling from php
// this departs a little from the shindig code but it should give is valid http protocol handling
header('Cache-Control: public,max-age=' . $this->cacheTime, true);
header("Expires: " . gmdate("D, d M Y H:i:s", time() + $this->cacheTime) . " GMT", true);
// Obey browsers (or proxy's) request to send a fresh copy if we recieve a no-cache pragma or cache-control request
if (!isset($_SERVER['HTTP_PRAGMA']) || !strstr(strtolower($_SERVER['HTTP_PRAGMA']), 'no-cache') && (!isset($_SERVER['HTTP_CACHE_CONTROL']) || !strstr(strtolower($_SERVER['HTTP_CACHE_CONTROL']), 'no-cache'))) {
if (isset($_SERVER['HTTP_IF_MODIFIED_SINCE']) && $this->lastModified && !isset($_SERVER['HTTP_IF_NONE_MATCH'])) {
$if_modified_since = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);
if ($this->lastModified <= $if_modified_since) {
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $this->lastModified) . ' GMT', true);
header("HTTP/1.1 304 Not Modified", true);
header('Content-Length: 0', true);
ob_end_clean();
die;
}
}
header('Last-Modified: ' . gmdate('D, d M Y H:i:s', $this->lastModified ? $this->lastModified : time()) . ' GMT', true);
}
}
} else {
ob_end_flush();
}
}
示例12: display
function display()
{
global $current_language;
if (empty($this->container_id)) {
$child_reports = ReportContainer::get_root_reports();
} else {
$container = new ReportContainer();
$container->retrieve($this->container_id);
$child_reports = $container->get_linked_beans("reports", "ZuckerReport");
}
$mod_strings = return_module_language($current_language, "ZuckerReports");
require_once 'include/ListView/ListView.php';
$lv = new ListView();
$lv->initNewXTemplate('modules/ZuckerReportContainer/DetailView.html', $mod_strings);
$lv->xTemplateAssign("DELETE_INLINE_PNG", get_image($image_path . 'delete_inline.png', 'align="absmiddle" alt="' . $app_strings['LNK_DELETE'] . '" border="0"'));
$lv->xTemplateAssign("EDIT_INLINE_PNG", get_image($image_path . 'edit_inline.png', 'align="absmiddle" alt="' . $app_strings['LNK_EDIT'] . '" border="0"'));
$lv->xTemplateAssign("RETURN_URL", "&return_module=ZuckerReportContainer&return_action=DetailView&return_id=" . $container->id);
$lv->setHeaderTitle("");
$lv->setHeaderText("");
ob_start();
$lv->processListViewTwo($child_reports, "reports", "REPORT");
$str = ob_get_clean();
ob_end_flush();
return parent::display() . $str;
}
示例13: render
/**
* Render the template, returning it's content.
*/
public function render($template, $variables = [])
{
extract($variables);
ob_start();
include views_path() . '/' . $template . '.php';
return ob_end_flush();
}
示例14: init
public function init()
{
if (file_exists($this->sock)) {
$this->log->error("Sock file already exists, concurrent process cannot be started");
exit;
}
$this->log->info('Streamer initialization');
// connection keep-alive, in other case browser will close it when receive last frame
header('Connection: keep-alive');
// disable caches
header('Cache-Control: no-cache');
header('Cache-Control: private');
header('Pragma: no-cache');
// x-mixed-replace to stream JPEG images
header('Content-type: multipart/x-mixed-replace; boundary=' . self::$BOUNDARY);
// set unlimited so PHP doesn't timeout during a long stream
set_time_limit(0);
// ignore user abort script
ignore_user_abort(true);
@apache_setenv('no-gzip', 1);
// disable apache gzip compression
@ini_set('zlib.output_compression', 0);
// disable PHP zlib compression
@ini_set('implicit_flush', 1);
// flush all current buffers
$k = ob_get_level();
for ($i = 0; $i < $k; $i++) {
ob_end_flush();
}
register_shutdown_function(array($this, 'shutdown'));
fclose(fopen($this->sock, 'w'));
$this->initialized = true;
}
示例15: endCache
/** Завършваме кеша и извеждаме на екрана **/
public function endCache()
{
if ($this->caching) {
file_put_contents($this->getFullPath(), ob_get_contents());
ob_end_flush();
}
}