set_time_limit函數(shù)可以臨時(shí)定義你當(dāng)前頁面的執(zhí)行時(shí)間,set_time_limit(0)時(shí)頁面就永遠(yuǎn)有效直到程序執(zhí)行完畢了,下面我來介紹set_time_limit用法.
語法 : void set_time_limit (int seconds)
注意 : 當(dāng)PHP是執(zhí)行在安全模式時(shí),set_time_limit( )將不會(huì)有結(jié)果,除非是關(guān)閉安全模式或是修改結(jié)構(gòu)檔案中(在PHP3中叫做php3.ini,在PHP4則叫做php.ini)的時(shí)間限制.
實(shí)例代碼如下:
<?php set_time_limit(1000) ?>
當(dāng)此函數(shù)被調(diào)用時(shí), set_time_limit()會(huì)從零開始重新啟動(dòng)超時(shí)計(jì)數(shù)器.換句話說,如果超時(shí)默認(rèn)是30秒,在腳本運(yùn)行了了25秒時(shí)調(diào)用 set_time_limit(20),那么,腳本在超時(shí)之前可運(yùn)行總時(shí)間為45秒.
實(shí)例代碼如下:
<?php require_once('db.php'); $stmt = $db->query($sql); while ($row = $stmt->fetchRow()) { set_time_limit(0); // your code here } ?>
相關(guān)文章:
php頁面最大執(zhí)行時(shí)間 set_time_limit函數(shù)不起作用

Hot AI Tools

Undress AI Tool
Undress images for free

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

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

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

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

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)
