limitlessremote php set_time_limit0 function to set program execution time

WBOY
Release: 2016-07-29 08:42:53
Original
1132 people have browsed it

set_time_limit(0);
The number in the brackets is the execution time. If it is zero, it means that it will be executed permanently until the end of the program. If it is a number greater than zero, the program will end after the set number of seconds, regardless of whether the program is completed.
A simple example, display 1500 statements on a web page. If the expiration time is not set, the program will end when it reaches 791. If the comment character // before set_time_limit(0); is removed, the program will not end until 1 .

Copy the code The code is as follows:


//set_time_limit(0);
$i=1500;
include ("inc/conn.php");
while($i> 0)
{
$sql="INSERT INTO php (php)
VALUES ('$i')";
if ($conn->execute($sql)===flase)
{
//echo " Data insertion error ".$conn->errormsg();
}
else
{
$phpid=$conn->Insert_ID();
echo $i." has been stored in the database, number: ".$phpid ;
}
$i--;
echo "


";
}
?>

The above introduces the function of limitlessremote php set_time_limit0 to set the program execution time, including the content of limitlessremote. I hope it will be helpful to friends who are interested in PHP tutorials.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!