【发布时间】:2017-12-21 15:08:50
【问题描述】:
我有问题。 我有路线:
$router->add('/news/{alias}(/?)', array(
'module' => 'frontend',
'controller' => 'news',
'action' => 'view',
'news_id' => 1,
'lang' => 'md',))->setName('news_view_short_e');
还有:
$router->add('/news/index/...
如果他包含“索引”,我如何检查 {alias}?
/news/{alias:(?!index)+}(/?)
不工作。 请帮忙。
我的链接:
site.com/news/index/ - 所有新闻
site.com/news/anlinter/ - 类别
site.com/news/231213-newsfriendly-url/ - 新闻视图
【问题讨论】:
-
您能用您想要实现的示例链接更新您的问题吗?
-
用链接更新了我的问题!
-
你想匹配包含索引的路由还是不包含索引的路由?
-
是的。示例:如果我访问 url site.com/news/anlinter 我得到 404 not found。如果我使用 {alias} 删除路由,我会得到正常的页面。如果他包含 (anlinter|index) ,我如何检查别名?