Zend framework Zend_Controller_Router_Route_Regex-请帮助我了解第四个参数
我举了一个例子:Zend framework Zend_Controller_Router_Route_Regex-请帮助我了解第四个参数,zend-framework,zend-route,zend-router,Zend Framework,Zend Route,Zend Router,我举了一个例子: $route = new Zend_Controller_Router_Route_Regex( 'blog/archive/(\d+)-(.+)\.html', array( 'controller' => 'blog', 'action' => 'view' ), array( 1 => 'id', 2 => 'description'
$route = new Zend_Controller_Router_Route_Regex(
'blog/archive/(\d+)-(.+)\.html',
array(
'controller' => 'blog',
'action' => 'view'
),
array(
1 => 'id',
2 => 'description'
),
'blog/archive/%d-%s.html'
);
$router->addRoute('blogArchive', $route);
有人能告诉我/%d,%s是什么意思吗?
例如,如果一个应用程序具有如下代码:
$route = new Zend_Controller_Router_Route_Regex("^([a-z,0-9,-]*)(/|)([a-z,0-9,-]*)(/|)([a-z,0-9,-]*)(/|)([a-z,0-9,-]*)(/|)([a-z,0-9,-]*)(/date/|)([a-z]*)(/page/|)([0-9]*)$",
array(
"module" => "default",
"controller" => "categories",
"action" => "index"
),
array(
1 => 'firstparam',
3 => 'secondparam',
5 => 'theeparam',
7 => 'fourparam',
9 => 'fiveparam',
11 => 'date',
13 => 'page',
)
);
如何编写示例中的最后一个参数('blog/archive/%d-%s.html')链接。谢谢大家!
%d
表示数字,%s
表示字符串
[a-z,0-9,-]*
是一个正则表达式。多读一些 为什么你在同一个问题上发布了两个问题?这不是同一个问题。我想写第四个参数,这样我就可以使用$this->url了。另一个是关于“唧唧,以避免这个规则适用于我的所有链接”