如何檢查當前頁面是否爲主頁?在我的標題中,我只想在主頁上顯示一些內容。zend2檢查主頁
$header = new ViewModel(array(
'login' => $this->getAuthService()->hasIdentity(),
'controller' => $this->getRequest()->getControllerName(),
'action' => $this->getRequest()->getActionName()
));
在我看來,我試圖通過查找索引控制器和索引操作來查找主頁,但這不起作用。
<?php
if($this->controller = 'index' && $this->action = 'index') {
echo 'home';
}
else {
echo 'not';
}
?>
有沒有比測試我的網址是否符合家鄉路線更簡單的方法? – user2406735