本文整理汇总了PHP中ob_flush函数的典型用法代码示例。如果您正苦于以下问题:PHP ob_flush函数的具体用法?PHP ob_flush怎么用?PHP ob_flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ob_flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: after_output
protected function after_output()
{
# flush once, because we're nice
if (ob_get_length()) {
ob_flush();
}
}
示例2: action_messages
public function action_messages($route_id, &$data, $args)
{
$uimessages = $_MIDCOM->serviceloader->load('uimessages');
if (!$uimessages->supports('comet') || !$uimessages->can_view()) {
return;
}
$type = null;
$name = null;
if (isset($_MIDCOM->dispatcher->get["cometType"])) {
$type = $_MIDCOM->dispatcher->get["cometType"];
}
if (isset($_MIDCOM->dispatcher->get["cometName"])) {
$name = $_MIDCOM->dispatcher->get["cometName"];
}
if ($type == null && $name == null) {
throw new midcom_exception_notfound("No comet name or type defined");
}
if (ob_get_level() == 0) {
ob_start();
}
while (true) {
$messages = '';
if ($uimessages->has_messages()) {
$messages = $uimessages->render_as('comet');
} else {
$uimessages->add(array('title' => 'Otsikko from comet', 'message' => 'viesti from comet...'));
}
midcom_core_helpers_comet::pushdata($messages, $type, $name);
ob_flush();
flush();
sleep(5);
}
// $data['messages'] = $messages;
}
示例3: add_sites
function add_sites($array)
{
global $db, $spider;
foreach ($array as $value) {
$row = $db->get_one("select * from ve123_links where url='" . $value . "'");
if (empty($row)) {
echo $value . "<br>";
$spider->url($value);
$title = $spider->title;
$fulltxt = $spider->fulltxt(800);
$keywords = $spider->keywords;
$description = $spider->description;
$pagesize = $spider->pagesize;
$htmlcode = $spider->htmlcode;
$array = array('url' => $value, 'title' => $title, 'fulltxt' => $fulltxt, 'pagesize' => $pagesize, 'keywords' => $keywords, 'description' => $description, 'addtime' => time(), 'updatetime' => time());
//echo $fulltxt;
$db->insert("ve123_links", $array);
file_put_contents(PATH . "k/www/" . base64_encode($value), $htmlcode);
//echo $htmlcode;
} else {
echo "已存在:" . $value . "<br>";
}
ob_flush();
flush();
sleep(1);
}
}
示例4: redirect
/**
* Redirige a una url
* @param mixed $url Url o arreglo que especifica prefijo, controlador y accion
*/
public static function redirect($url = null)
{
ob_start();
header('Location:' . \Supernova\Route::generateUrl($url));
ob_flush();
die;
}
示例5: buffer_flush
function buffer_flush()
{
echo '<!-- -->';
// ?
ob_flush();
flush();
}
示例6: postNote
/**
* post Note Action
*
* @param string $httpData->appUid (optional, if it is not passed try use $_SESSION['APPLICATION'])
* @return array containg the case notes
*/
function postNote($httpData)
{
require_once "classes/model/AppNotes.php";
//extract(getExtJSParams());
if (isset($httpData->appUid) && trim($httpData->appUid) != "") {
$appUid = $httpData->appUid;
} else {
$appUid = $_SESSION['APPLICATION'];
}
if (!isset($appUid)) {
throw new Exception('Can\'t resolve the Apllication ID for this request.');
}
$usrUid = isset($_SESSION['USER_LOGGED']) ? $_SESSION['USER_LOGGED'] : "";
$noteContent = addslashes($httpData->noteText);
//Disabling the controller response because we handle a special behavior
$this->setSendResponse(false);
//Add note case
$appNote = new AppNotes();
$response = $appNote->addCaseNote($appUid, $usrUid, $noteContent, intval($httpData->swSendMail));
//Send the response to client
@ini_set("implicit_flush", 1);
ob_start();
echo G::json_encode($response);
@ob_flush();
@flush();
@ob_end_flush();
ob_implicit_flush(1);
}
示例7: flushPause
function flushPause($pause = 0)
{
echo ob_get_clean();
@ob_flush();
flush();
usleep($pause * 1000000);
}
示例8: index_f
function index_f()
{
$id = $this->trans_lib->int("id");
if (!$id) {
error($this->lang["download_error"], $this->url());
}
$rs = $this->upfile_m->get_one($id);
//执行下载操作
if (!file_exists(ROOT . $rs["filename"]) || !$rs["filename"] || !is_file(ROOT . $rs["filename"])) {
error($this->lang["download_empty"], $this->url());
}
$filesize = filesize(ROOT . $rs["filename"]);
if (!$rs["title"]) {
$rs["title"] = $rs["filename"];
}
$tmpname = str_replace("." . $rs["ftype"], "", $rs["title"]);
$tmpname = $tmpname . "." . $rs["ftype"];
ob_end_clean();
header("Date: " . gmdate("D, d M Y H:i:s", $rs["postdate"]) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $rs["postdate"]) . " GMT");
header("Content-Encoding: none");
header("Content-Disposition: attachment; filename=" . rawurlencode($tmpname));
header("Content-Length: " . $filesize);
header("Accept-Ranges: bytes");
readfile($rs["filename"]);
flush();
ob_flush();
}
示例9: show_captcha
public function show_captcha()
{
if (session_id() == "") {
session_name("CAKEPHP");
session_start();
}
$vendor_path = App::path('Vendor');
$path = $vendor_path[0] . 'captcha';
$imgname = 'bg.jpg';
$imgpath = $path . DS . 'images' . DS . $imgname;
$captchatext = md5(time());
$captchatext = substr($captchatext, 0, 5);
$_SESSION['captcha'] = $captchatext;
if (file_exists($imgpath)) {
$im = imagecreatefromjpeg($imgpath);
$grey = imagecolorallocate($im, rand(1, 128), 128, 128);
$font = $path . DS . 'fonts' . DS . '3D_Noise.ttf';
imagettftext($im, 36, 0, 0, 55, $grey, $font, $captchatext);
header('Content-Type: image/jpeg');
header("Cache-control: private, no-cache");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Pragma: no-cache");
imagejpeg($im);
imagedestroy($im);
ob_flush();
flush();
} else {
echo 'captcha error';
exit;
}
}
示例10: download_f
function download_f()
{
$file = $this->get("file");
$id = $this->get("id");
if (!$id && !$file) {
error(P_Lang('未指定ID'), "", "error");
}
if ($id) {
$rs = $this->model('res')->get_one($id);
$file = $rs["filename"];
$title = $rs["title"] . "." . $rs["ext"];
} else {
$title = basename($file);
}
if (!$file) {
error(P_Lang('未指定附件'), "", "error");
}
if (substr($file, 0, 7) != "http://" && substr($file, 0, 8) != "https://") {
$file = $this->dir_root . $file;
}
if (!file_exists($file)) {
error(P_Lang('附件不存在'), "", "error");
}
$filesize = filesize($file);
ob_end_clean();
header("Date: " . gmdate("D, d M Y H:i:s", $this->system_time) . " GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s", $this->system_time) . " GMT");
header("Content-Encoding: none");
header("Content-Disposition: attachment; filename=" . rawurlencode($title));
header("Content-Length: " . $filesize);
header("Accept-Ranges: bytes");
readfile($file);
flush();
ob_flush();
}
示例11: flush
public function flush(\JsonSerializable $object)
{
echo json_encode($object) . "\n";
flush();
ob_flush();
usleep(333);
}
示例12: backview
/**
* Inlude a view path
**/
function backview($view, $variables = array())
{
extract($variables);
ob_flush();
include_once views('backend/' . $view);
ob_clean();
}
示例13: display
function display()
{
$focus = new Insurances();
$ss = new Sugar_Smarty();
$db = DBManagerFactory::getInstance();
// ONLY LOAD A RECORD IF A RECORD ID IS GIVEN;
// A RECORD ID IS NOT GIVEN WHEN VIEWING IN LAYOUT EDITOR
$record = isset($_GET["record"]) ? htmlspecialchars($_GET["record"]) : '';
$template = file_get_contents('modules/Insurances/tpls/export.tpl');
$name = "";
$start = "";
$end = "";
$canhan = "";
$giadinh = "";
$canhan = $focus->get_data_insurances_canhan($record, $name, $start, $end);
$giadinh = $focus->get_data_insurances_giadinh($record, $name, $start, $end);
$template = str_replace("{CANHAN}", $canhan, $template);
$template = str_replace("{GIADINH}", $giadinh, $template);
$template = str_replace("{TITLE}", $name, $template);
$template = str_replace("{NGAYBATDAU}", $start, $template);
$template = str_replace("{NGAYKETTHUC}", $end, $template);
$size = strlen($template);
$filename = strtoupper($name) . ".doc";
ob_end_clean();
header("Cache-Control: private");
header("Content-Type: application/force-download;");
header("Content-Disposition:attachment; filename=\"{$filename}\"");
header("Content-length:{$size}");
echo $template;
ob_flush();
}
示例14: do_it
function do_it($image, $ImgWaterPath, $ImgWaterPos, $ImageWaterAlpha, $i)
{
echo "正在处理第" . $i . "张图片:" . $image . "<br/>";
flush();
ob_flush();
Image::water($image, $ImgWaterPath, $ImgWaterPos, '', $ImageWaterAlpha);
}
示例15: download
public function download($file, $name = '', $size = 0, $reload = false)
{
if ($name == '') {
$name = basename($file);
}
$fp = fopen($file, 'rb');
if (!$size) {
$size = filesize($file);
}
$ranges = $this->getRange($size);
if ($reload && $ranges != null) {
header('HTTP/1.1 206 Partial Content');
header('Accept-Ranges:bytes');
header(sprintf('content-length:%u', $ranges['end'] - $ranges['start']));
header(sprintf('content-range:bytes %s-%s/%s', $ranges['start'], $ranges['end'], $size));
fseek($fp, sprintf('%u', $ranges['start']));
} else {
header('HTTP/1.1 200 OK');
header('content-length:' . $size);
}
while (!feof($fp)) {
echo fread($fp, round($this->_speed * 1024, 0));
ob_flush();
flush();
//sleep(1);
}
$fp != null && fclose($fp);
}