Home > Article > Backend Development > 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('h:i:s') . "<br />"; //延迟 10 描述 usleep(10000000); //再次开始 echo date('h:i:s'); 输出显示: 09:23:14 09:23:24 //sleep() 函数 echo date('h:i:s') . "<br>"; //sleep for 5 seconds sleep(5); //start again echo date('h:i:s'); 输出显示: 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!