English 中文(简体)
PHP 时间使用
原标题:PHP Timer usage
  • 时间:2011-08-03 11:17:24
  •  标签:
  • php
  • timer

Firstly, I want to echo text and ,after 5 seconds,I want to echo another text. So I write...

<?php

echo  Text ;
flush();

sleep(5);

flush();
echo  Another Text ;


?>

But I see both of (Text Another Text ) after 5 seconds.How can I do for this?

问题回答

文件

一些服务器,特别是Win32的服务器,在把结果传送给浏览器之前,仍会从你的文字中缓冲产出。

因此,请参看<代码>TextAnother Texttogether。

Take a look at output buffering.

Have you started output buffering at some time? If so, you need to use ob_end_flush() to flush.

如果你能够放弃或叫 ob肥料,则放弃产出缓冲。 任何产出压缩(如gzip)也将随之而来。 如果做不到工作,试图修改这2 php.ini指令,以便:

产出:

zlib.output_compression = off





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签