未定义或定义的索引?决定
我有奇怪的问题。
Line 61: $this->_currentRoute = Default_Model_Routes::getInstance()->getCurrentRoute();
.......... other code ..........
Line 86: var_dump(isset($this->_currentRoute['url']));
Line 87: var_dump($this->_currentRoute['url']);
Line 88: if ($this->_currentRoute['url'] == $currentUrl)
Line 89: $navigation[$key]['active'] = true;
Line 90: var_dump($this->_currentRoute);
这是结果:
bool(true)
string(62) "cs/Polozka-menu-1/Polozka-menu-1-1/Polozka-menu-1-1-1/Clanek-1"
array(17) {
["url"]=>
string(62) "cs/Polozka-menu-1/Polozka-menu-1-1/Polozka-menu-1-1-1/Clanek-1"
["type"]=>
string(7) "article"
............
}
在错误日志中:
[09-Mar-2011 19:49:32] PHP Notice: Undefined index: url in ...file... on line 87
[09-Mar-2011 19:49:32] PHP Notice: Undefined index: url in ...file... on line 88
如果您有任何想法可能出现问题或如何修复,请告诉我。 谢谢:)
我尝试了另一个测试:
$test = array();
echo $test['lol'];
结果是:
Notice: Undefined index: lol in ...file... on line 92
Somethink确实很有趣:这个“lol”错误显示在输出中,但“url”错误不是!它只在日志中...为什么???这是同一个文件,位于“url”var_dump() 下的行...疯狂
I have strange problem.
Line 61: $this->_currentRoute = Default_Model_Routes::getInstance()->getCurrentRoute();
.......... other code ..........
Line 86: var_dump(isset($this->_currentRoute['url']));
Line 87: var_dump($this->_currentRoute['url']);
Line 88: if ($this->_currentRoute['url'] == $currentUrl)
Line 89: $navigation[$key]['active'] = true;
Line 90: var_dump($this->_currentRoute);
This is result:
bool(true)
string(62) "cs/Polozka-menu-1/Polozka-menu-1-1/Polozka-menu-1-1-1/Clanek-1"
array(17) {
["url"]=>
string(62) "cs/Polozka-menu-1/Polozka-menu-1-1/Polozka-menu-1-1-1/Clanek-1"
["type"]=>
string(7) "article"
............
}
And in the error log:
[09-Mar-2011 19:49:32] PHP Notice: Undefined index: url in ...file... on line 87
[09-Mar-2011 19:49:32] PHP Notice: Undefined index: url in ...file... on line 88
Please, if you have any ideas where could be problem or how to fix, tell me.
Thank you :)
I have tried another test:
$test = array();
echo $test['lol'];
With this result:
Notice: Undefined index: lol in ...file... on line 92
Somethink really interesting: THIS 'lol' error is displayed in output, BUT the 'url' error IS NOT ! It is only in the log ... why ????? It's same file, line under the 'url' var_dump() ... crazy
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
如果您首先将
$this->_currentRoute
分配给变量会发生什么?已解决(请参阅评论)
不幸的是,这是 Zend Server 或前沿 PHP 5.3.3 的问题。
What happens if you assign
$this->_currentRoute
to a variable first?Solved (see comments)
This was unfortunately an issue with Zend Server, or bleeding edge PHP 5.3.3.
也许这不是你的错误?
尝试
ini_set('display_errors', 1);
另请参阅方法
Default_Model_Routes::getInstance()->getCurrentRoute()::__get()
阅读此内容
Maybe this is not you errors?
Try to
ini_set('display_errors', 1);
And also see method
Default_Model_Routes::getInstance()->getCurrentRoute()::__get()
Read this