如何在运行时覆盖max_execution_time的php.ini值?

use*_*264 3 php

我没有php.ini在我的服务器上访问.我想更改最长执行时间,以便我的脚本可以运行超过30秒.

我有什么方法可以在我的剧本开头做到这一点?

Yog*_*har 6

使用 ini_set

ini_set('max_execution_time', 300);  // this will set max_execution time for 300 seconds
Run Code Online (Sandbox Code Playgroud)

在php文件中的代码开头写这行.

要么

用这个来自 HankyPankyㇱ

set_time_limit(300);
Run Code Online (Sandbox Code Playgroud)