“致命错误:达到最大函数嵌套级别‘100’,正在中止!"的解决方案在 PHP 中 [英] Solution for "Fatal error: Maximum function nesting level of '100' reached, aborting!" in PHP
问题描述
我创建了一个函数,可以在一个 html 文件中查找所有 URL,并对链接到发现的 URL 的每个 html 内容重复相同的过程.该函数是递归的,可以无休止地运行.但是,我通过设置一个全局变量来限制递归,这会导致递归在 100 次递归后停止.
I have made a function that finds all the URLs within an html file and repeats the same process for each html content linked to the discovered URLs. The function is recursive and can go on endlessly. However, I have put a limit on the recursion by setting a global variable which causes the recursion to stop after 100 recursions.
然而,php 返回此错误:
However, php returns this error:
致命错误:达到了100"的最大函数嵌套级别,流产!在D:wampwwwcrawler1simplehtmldom_1_5simple_html_dom.php 上线1355
Fatal error: Maximum function nesting level of '100' reached, aborting! in D:wampwwwcrawler1simplehtmldom_1_5simple_html_dom.php on line 1355
我在这里找到了一个解决方案:增加嵌套函数调用限制但这不是在我的情况下工作.
I found a solution here: Increasing nesting function calls limit but this is not working in my case.
我引用了上述链接中的一个答案.请考虑一下.
"您是否安装了 Zend、IonCube 或 xDebug?如果是这样,那可能就是您收到此错误的地方.
"Do you have Zend, IonCube, or xDebug installed? If so, that is probably where you are getting this error from.
几年前我遇到了这个问题,结果是 Zend 设置了这个限制,而不是 PHP.当然,删除它会让 >你超过 100 次迭代,但你最终会达到内存限制."
I ran into this a few years ago, and it ended up being Zend putting that limit there, not PHP. Of course removing it will let >you go past the 100 iterations, but you will eventually hit the memory limits."
有没有办法提高PHP中的最大函数嵌套级别
Is there a way to increase the maximum function nesting level in PHP
推荐答案
一个简单的解决方案解决了我的问题.我刚刚评论了这一行:
A simple solution solved my problem. I just commented this line:
zend_extension = "d:/wamp/bin/php/php5.3.8/zend_ext/php_xdebug-2.1.2-5.3-vc9.dll
在我的 php.ini
文件中.这个扩展将堆栈限制为 100
,所以我禁用了它.递归函数现在按预期工作.
in my php.ini
file. This extension was limiting the stack to 100
so I disabled it. The recursive function is now working as anticipated.
这篇关于“致命错误:达到最大函数嵌套级别‘100’,正在中止!"的解决方案在 PHP 中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!