我从一个在线源下载一个JSON文件,当它通过循环运行时,我得到这个错误:

致命错误:C:\wamp\www\temp\fetch.php第24行超过最大执行时间30秒


当前回答

我有同样的问题,并通过改变参数max_execution_time在php.ini中的值来解决它,就像这样:

max_execution_time = 360      ; Maximum execution time of each script, in seconds (I CHANGED THIS VALUE)
max_input_time = 120          ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 128M           ; Maximum amount of memory a script may consume (128MB by default)

我希望这能帮助到你。

其他回答

我们可以用三种不同的方法来解决这个问题。

1)使用php.ini文件

2)使用。htaccess文件

3)使用Wp-config.php文件(Wordpress)

也许可以检查php.ini文件下更改的任何内容。 例如,我将“;Intl .default_locale =”更改为“;Intl .default_locale = en_utf8”,以便启用“国际化扩展(Intl)”而不添加“extension=php_intl.dll”,然后出现相同的错误。所以我建议检查类似的错误。

使用WHM可以很容易地做到这一点。刚到:

WHM -> Service Configuration -> PHP配置 编辑- > max_execution_time = 30

(30是默认值,更改为任何你想要的值)

我有同样的问题,并通过改变参数max_execution_time在php.ini中的值来解决它,就像这样:

max_execution_time = 360      ; Maximum execution time of each script, in seconds (I CHANGED THIS VALUE)
max_input_time = 120          ; Maximum amount of time each script may spend parsing request data
;max_input_nesting_level = 64 ; Maximum input variable nesting level
memory_limit = 128M           ; Maximum amount of memory a script may consume (128MB by default)

我希望这能帮助到你。

您的脚本超时了。看一下set_time_limit()函数来延长执行时间。或者分析脚本,使其运行得更快:)