php中的Maxim函数嵌套
我有一个问题,当我试图定义一个变量时,我得到了一个错误php中的Maxim函数嵌套,php,Php,我有一个问题,当我试图定义一个变量时,我得到了一个错误 Maximum function nesting level of '500' reached, aborting! 我的代码是: if (isset($this->a_environmentSupported[$s_environment])) { $this->s_environment = $s_environment; define('PROJECT_PATH', Context::ge
Maximum function nesting level of '500' reached, aborting!
我的代码是:
if (isset($this->a_environmentSupported[$s_environment])) {
$this->s_environment = $s_environment;
define('PROJECT_PATH', Context::getInstance()->getEnvironment()->getConfiguration('project_path'));
} else {
throw new \UnexpectedValueException(sprintf('The environment "%s" is not supported.', $s_environment));
}
我增加xdebug.max_nesting_level=1000。
问题出在define中,因为如果我删除define,应用程序就是work。
请帮帮我!Thx提前不,问题不在于定义,这是因为您没有做任何事情来触发递归的结束有一个解决方案来解决这个问题?解决方案是确保您的递归在需要时正确地终止到上下文::getInstance->getEnvironment->getConfiguration'project_path'?您处于无限递归中并导致堆栈溢出。如果您的递归没有终止条件,或者终止条件永远不会发生,或者只能在超过允许的最大递归次数后发生,那么这就是将发生的情况。