本文整理汇总了PHP中flush函数的典型用法代码示例。如果您正苦于以下问题:PHP flush函数的具体用法?PHP flush怎么用?PHP flush使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了flush函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: paintResult
/**
* Paint the result of a send operation
* @param string The email address that was tried
* @param boolean True if the message was successfully sent
*/
public function paintResult($address, $result)
{
$this->count++;
$color = $result ? "#51c45f" : "#d67d71";
$result_text = $result ? "PASS" : "FAIL";
?>
<div style="color: #ffffff; margin: 2px; padding: 3px;
font-weight: bold; background: <?php
echo $color;
?>
;">
<span style="float: right; text-decoration: underline;"> <?php
echo $result_text;
?>
</span> Recipient (
<?php
echo $this->count;
?>
):
<?php
echo $address;
?>
</div>
<?php
flush();
}
示例2: allTests
function allTests($communicator)
{
global $NS;
echo "testing type names... ";
flush();
$a = $NS ? constant("_and\\_array::_as") : constant("and_array::_as");
$b = $NS ? eval("return new _and\\_xor();") : eval("return new and_xor();");
test($b->_abstract == 0);
test($b->_clone == 0);
test($b->_private == 0);
test($b->_protected == 0);
test($b->_public == 0);
test($b->_this == 0);
test($b->_throw == 0);
test($b->_use == 0);
test($b->_var == 0);
$p = $communicator->stringToProxy("test:tcp -p 10000");
$c = $NS ? eval("return _and\\functionPrxHelper::uncheckedCast(\$p);") :
eval("return and_functionPrxHelper::uncheckedCast(\$p);");
$d = $NS ? eval("return _and\\diePrxHelper::uncheckedCast(\$p);") :
eval("return and_diePrxHelper::uncheckedCast(\$p);");
$e = $NS ? eval("return _and\\echoPrxHelper::uncheckedCast(\$p);") :
eval("return and_echoPrxHelper::uncheckedCast(\$p);");
$e1 = new echoI();
$f = $NS ? eval("return _and\\enddeclarePrxHelper::uncheckedCast(\$p);") :
eval("return and_enddeclarePrxHelper::uncheckedCast(\$p);");
$f1 = new enddeclareI();
$g = $NS ? eval("return new _and\\_endif();") : eval("return new and_endif();");
$h = $NS ? eval("return new _and\\_endwhile();") : eval("return new and_endwhile();");
$i = $NS ? constant("_and\\_or") : constant("and_or");
$j = $NS ? constant("_and\\_print") : constant("and_print");
$j = $NS ? constant("_and\\_require_once") : constant("and_require_once");
echo "ok\n";
}
示例3: finishTurn
public function finishTurn()
{
echo "go\n";
$this->debug("Remaining Time: " . $this->timeRemaining() . "\n");
$this->debug("-------TURN-------\n");
flush();
}
示例4: updateInfo
function updateInfo($percent, $infoText, $debug = true) {
global $command_line;
if ($debug) {
Debug::message($infoText, Debug::WARNING);
}
$percentageText = ($percent == 1)? '100': sprintf('%2.0f', $percent * 100);
if (isset($command_line) and $command_line) {
if ($percent < 0) {
$percentageText = ' * ';
} else {
$percentageText .= '%';
}
echo $percentageText, ' ', $infoText, "\n";
} else {
echo '<script>';
if ($percent >= 0) {
echo 'document.getElementById("progress-bar").style="width:' . ($percent * 100) . '%;";', "\n",
'document.getElementById("progress-bar").innerHTML ="' . $percentageText . '%";', "\n";
}
if ($percent == 1) {
echo 'document.getElementById("progress-bar").className = "progress-bar progress-bar-striped";';
}
echo 'document.getElementById("progressbar-info").innerHTML="' . addslashes($infoText) . '";</script>';
}
// This is for the buffer achieve the minimum size in order to flush data
// echo str_repeat(' ', 1024 * 64);
// Send output to browser immediately
flush();
}
示例5: 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);
}
}
示例6: testdb
function testdb(&$db, $createtab = "create table ADOXYZ (id int, firstname char(24), lastname char(24), created date)")
{
global $ADODB_version, $ADODB_FETCH_MODE;
adodb_backtrace();
$max = 100;
$sql = 'select * from ADOXYZ';
$ADODB_FETCH_MODE = ADODB_FETCH_NUM;
//print "<h3>ADODB Version: $ADODB_version Host: <i>$db->host</i> Database: <i>$db->database</i></h3>";
// perform query once to cache results so we are only testing throughput
$rs = $db->Execute($sql);
if (!$rs) {
print "Error in recordset<p>";
return;
}
$arr = $rs->GetArray();
//$db->debug = true;
global $ADODB_COUNTRECS;
$ADODB_COUNTRECS = false;
$start = microtime();
for ($i = 0; $i < $max; $i++) {
$rs =& $db->Execute($sql);
$arr =& $rs->GetArray();
// print $arr[0][1];
}
$end = microtime();
$start = explode(' ', $start);
$end = explode(' ', $end);
//print_r($start);
//print_r($end);
// print_r($arr);
$total = $end[0] + trim($end[1]) - $start[0] - trim($start[1]);
printf("<p>seconds = %8.2f for %d iterations each with %d records</p>", $total, $max, sizeof($arr));
flush();
//$db->Close();
}
示例7: debug
function debug($texto)
{
file_put_contents(TEMPLATEPATH . '/log.log', date('d/m/Y H:i:s') . ' - ' . $texto . "\n", FILE_APPEND);
//echo date('d/m/Y H:i:s').' - '.$texto."<br>";
flush();
return;
}
示例8: exportCallback
/**
* @param ContextInterface $context
* @param StepExecutor $executor
*
* @return \Closure
*/
protected function exportCallback(ContextInterface $context, StepExecutor $executor)
{
return function () use($executor) {
flush();
$executor->execute();
};
}
示例9: importFromRedshop
function importFromRedshop()
{
@ob_clean();
echo $this->getHtmlPage();
$this->token = hikashop_getFormToken();
flush();
if (isset($_GET['import']) && $_GET['import'] == '1') {
$time = microtime(true);
$processed = $this->doImport();
if ($processed) {
$elasped = microtime(true) - $time;
if (!$this->refreshPage) {
echo '<p></br><a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=import&importfrom=redshop&' . $this->token . '=1&import=1&time=' . time()) . '">' . JText::_('HIKA_NEXT') . '</a></p>';
}
echo '<p style="font-size:0.85em; color:#605F5D;">Elasped time: ' . round($elasped * 1000, 2) . 'ms</p>';
} else {
echo '<a' . $this->linkstyle . 'href="' . hikashop_completeLink('import&task=show') . '">' . JText::_('HIKA_BACK') . '</a>';
}
} else {
echo $this->getStartPage();
}
if ($this->refreshPage) {
echo "<script type=\"text/javascript\">\r\nr = true;\r\n</script>";
}
echo '</body></html>';
exit;
}
示例10: flushPause
function flushPause($pause = 0)
{
echo ob_get_clean();
@ob_flush();
flush();
usleep($pause * 1000000);
}
示例11: sMain
/**
* function sMain ()
* Khoi tao
**/
function sMain()
{
global $ttH;
$ttH->func->load_language($this->modules);
$fun = isset($ttH->post['f']) ? $ttH->post['f'] : '';
flush();
switch ($fun) {
case "load_country_op":
echo $this->do_load_country_op();
exit;
break;
case "load_province_op":
echo $this->do_load_province_op();
exit;
break;
case "load_district_op":
echo $this->do_load_district_op();
exit;
break;
case "load_ward_op":
echo $this->do_load_ward_op();
exit;
break;
default:
echo '';
exit;
break;
}
exit;
}
示例12: GAL_getImageInfo
function GAL_getImageInfo($folder, $file)
{
$thumbFolder = $folder . $GLOBALS['GAL_thumbnail_folder'];
$fileName = $file . '.meta';
$ret = array();
$ret['dateLastModified'] = -1;
clearstatcache();
if (!file_exists($thumbFolder . $fileName)) {
$dateLastModified = @filemtime($folder . $file);
$f = @fopen($thumbFolder . $fileName, 'wb');
if (is_resource($f)) {
fwrite($f, $dateLastModified);
fclose($f);
}
$ret['dateLastModified'] = $dateLastModified;
} else {
$f = @fopen($thumbFolder . $fileName, 'rb');
if (is_resource($f)) {
$dateLastModified = trim(@fread($f, filesize($thumbFolder . $fileName)));
fclose($f);
}
$ret['dateLastModified'] = $dateLastModified;
}
flush();
return $ret;
}
示例13: CreateConfigFile
function CreateConfigFile()
{
global $dbUser, $dbPass, $dbHost, $dbName, $user, $md5pass;
$config = <<<DATA
<?php
define('MYSQL_HOST', '{$dbHost}');
define('MYSQL_LOGIN', '{$dbUser}');
define('MYSQL_PASSWORD', '{$dbPass}');
define('MYSQL_DB', '{$dbName}');
define('USER', '{$user}');
define('PASS', '{$md5pass}');
//define('DEBUG', true);
//define('MYSQL_DEBUG', true);
//define('TIME_DEBUG', true);
DATA;
$fh = @fopen('config.php', 'wb');
if (false === $fh) {
echo "Can't create config.php. Create it manually with next content:\n<hr><pre>";
echo htmlspecialchars($config);
flush();
exit;
}
fwrite($fh, $config);
}
示例14: 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);
}
示例15: send
function send($newsletter_id)
{
global $db;
$audience_select = get_audience_sql_query($this->query_name, 'newsletters');
$audience = $db->Execute($audience_select['query_string']);
$records = $audience->RecordCount();
if ($records == 0) {
return 0;
}
$i = 0;
while (!$audience->EOF) {
$i++;
$html_msg['EMAIL_FIRST_NAME'] = $audience->fields['customers_firstname'];
$html_msg['EMAIL_LAST_NAME'] = $audience->fields['customers_lastname'];
$html_msg['EMAIL_GREET'] = EMAIL_GREET;
$html_msg['EMAIL_MESSAGE_HTML'] = $this->content_html;
zen_mail($audience->fields['customers_firstname'] . ' ' . $audience->fields['customers_lastname'], $audience->fields['customers_email_address'], $this->title, $this->content, STORE_NAME, EMAIL_FROM, $html_msg, 'newsletters');
echo zen_image(DIR_WS_ICONS . 'tick.gif', $audience->fields['customers_email_address']);
//force output to the screen to show status indicator each time a message is sent...
if (function_exists('ob_flush')) {
@ob_flush();
}
@flush();
$audience->MoveNext();
}
$newsletter_id = zen_db_prepare_input($newsletter_id);
$db->Execute("update " . TABLE_NEWSLETTERS . "\r\n set date_sent = now(), status = '1'\r\n where newsletters_id = '" . zen_db_input($newsletter_id) . "'");
return $records;
//return number of records processed whether successful or not
}