Twitter Delicious Facebook Digg Stumbleupon Favorites More

Thứ Tư

Ham Delay trong PHP(sleep or usleep)

1.Hàm sleep :
int sleep ( int $seconds );

Examples:

<?php

// current time
echo date('h:i:s') . "\n";

// sleep for 10 seconds
sleep(10);

// wake up !
echo date('h:i:s') . "\n";

?>
tham khảo thêm ở PHP Manual :http://php.net/manual/en/function.sleep.php
2.Hàm usleep :
 
void usleep ( int $micro_seconds );
 
Example:
<?php

// Current time
echo date('h:i:s') . "\n";

// wait for 2 seconds
usleep(2000000);

// back!
echo date('h:i:s') . "\n";

?>
tham khảo thêm ở PHP Manual :http://php.net/manual/en/function.usleep.php

0 nhận xét:

Đăng nhận xét

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Blogger Templates