我只从 5.8* 升级到 Laravle ^6.0。在运行 $composer require laravel/passport
我收到错误消息“包 zendframework/zend-diactoros 被放弃,你应该避免使用它。使用 laminas/laminas-diactoros 代替。”
我已经安装 laminas-json
这样就够了吗?
layout使用Zend View时, Zend Expressive 默认为模板。我注意到PhpRendereraddTemplate($template)类中的函数,但是在哪里以及如何添加替代模板?layout
在操作的中间件工厂中,在操作本身中,还是在其他地方?
我知道我可以生成传递路由名称的 URL
<?php echo $this->url('route-name') #in view file ?>
Run Code Online (Sandbox Code Playgroud)
但我可以获得相反方向的信息吗?我需要从当前的 URL/URI 获取路由名称。
真实情况是:我有layout.phtml,其中顶部菜单(html)。菜单中的当前链接需要用 css 类标记。所以,我需要的例子是:
<?php // in layout.phtml file
$index_css = $this->getRouteName() == 'home-page' ? 'active' : 'none';
$about_css = $this->getRouteName() == 'about' ? 'active' : 'none';
$contact_css = $this->getRouteName() == 'contact' ? 'active' : 'none';
?>
Run Code Online (Sandbox Code Playgroud)
我正在使用快速路线,但我对任何解决方案都很感兴趣。解决方案不必位于视图文件中。