Home  >  Article  >  Backend Development  >  PHP searches after a few seconds delay

PHP searches after a few seconds delay

(*-*)浩
(*-*)浩Original
2019-10-18 09:45:292496browse

PHP searches after a few seconds delay

#sleep() function delays the execution of the current script for a few seconds.

Note: If the specified number of seconds is negative, this function will throw an error. (Recommended learning: PHP Video Tutorial) The

usleep() function suspends the thread that calls the function for a period of time. The unit is microseconds (millionths of a second).

//usleep()函数

echo date(&#39;h:i:s&#39;) . "<br />";

//延迟 10 描述
usleep(10000000);

//再次开始
echo date(&#39;h:i:s&#39;);

输出显示:
09:23:14
09:23:24

//sleep() 函数

echo date(&#39;h:i:s&#39;) . "<br>";

//sleep for 5 seconds
sleep(5);

//start again
echo date(&#39;h:i:s&#39;);

输出显示:
09:23:14
09:23:19

Simple PHP search

Add the search statement to the initial query statement; thereby simplifying the code

$news_sql = "SELECT * from books where 1=1 ".$searchAddSql." order by book_number ";

$searchAddSql It is empty at first. If the user enters search conditions, $searchAddSql

will become a string containing the query statement.

The above is the detailed content of PHP searches after a few seconds delay. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn