我試圖匹配當前URL,用戶是在一個路線,並輸出一個「積極的」類,如果在路由匹配:Zend框架2匹配當前URL路由
<?php if($this->url() == $this->url('dashboard')) echo "class='active'" ?>
這部作品存在的路線。但是,這會弄亂404路由;如果我去了一個不存在的路徑,即本地主機/ someurl,我得到:
Fatal error: Uncaught exception 'Zend\View\Exception\RuntimeException' with message 'No RouteMatch instance provided'
什麼是去了解這一點的最好方法是什麼?
未設置404 routemath。捕捉異常怎麼樣? –