SilverStripe 3 自定义路由通配符
SilverStripe 3 custom routing Wildcard
我想创建一个涵盖任何内容的自定义路由。
是否可以在路由中设置通配符?
例如http://example.com/*/show/urlsegment
我试过很多东西都没有成功。
Director::addRules(100, array(
'*/show//$EventUrlSegment' => 'MyTest_Controller'
));
涵盖 /show
之前任何内容的正确语法是什么?
在 Silverstripe 3.* 中,您应该使用 _config
文件夹中的 yaml 文件。
您可以像使用 EventUrlSegment
一样使用 $
定义通配符
Director:
rules:
'$Action/show/$EventUrlSegment' : 'MyTest_Controller'
我想创建一个涵盖任何内容的自定义路由。
是否可以在路由中设置通配符?
例如http://example.com/*/show/urlsegment
我试过很多东西都没有成功。
Director::addRules(100, array(
'*/show//$EventUrlSegment' => 'MyTest_Controller'
));
涵盖 /show
之前任何内容的正确语法是什么?
在 Silverstripe 3.* 中,您应该使用 _config
文件夹中的 yaml 文件。
您可以像使用 EventUrlSegment
$
定义通配符
Director:
rules:
'$Action/show/$EventUrlSegment' : 'MyTest_Controller'