set_time_limit函数可以临时定义你当前页面的执行时间,set_time_limit(0)时页面就永远有效直到程序执行完毕了,下面我来介绍set_time_limit用法.
语法 : void set_time_limit (int seconds)
注意 : 当PHP是执行在安全模式时,set_time_limit( )将不会有结果,除非是关闭安全模式或是修改结构档案中(在PHP3中叫做php3.ini,在PHP4则叫做php.ini)的时间限制.
实例代码如下:
<?php set_time_limit(1000) ?>
当此函数被调用时, set_time_limit()会从零开始重新启动超时计数器.换句话说,如果超时默认是30秒,在脚本运行了了25秒时调用 set_time_limit(20),那么,脚本在超时之前可运行总时间为45秒.
实例代码如下:
<?php require_once('db.php'); $stmt = $db->query($sql); while ($row = $stmt->fetchRow()) { set_time_limit(0); // your code here } ?>
相关文章:
php页面最大执行时间 set_time_limit函数不起作用

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

ZendStudio 13.5.1 Mac
Powerful PHP integrated development environment

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

Notepad++7.3.1
Easy-to-use and free code editor

DVWA
Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software
