我有一个奇怪的问题。
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()... crazy
答案 0 :(得分:2)
$this->_currentRoute
分配给变量会怎样?$route = $this->_currentRoute;
var_dump(array_key_exists('url', $route));
var_dump(isset($route['url']));
print "PRINTING: ".$route['url'];
die("ENDING ON LINE [".__LINE__."] !!!");
遗憾的是,这是Zend Server的问题,或者是前沿的PHP 5.3.3。
答案 1 :(得分:0)
也许这不是你的错误?
尝试ini_set('display_errors', 1);
另请参阅方法Default_Model_Routes::getInstance()->getCurrentRoute()::__get()