Zend_Controller_Router_Route_Regex - 请帮我第四个参数

时间:2014-01-24 12:48:17

标签: 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'
    ),
    'blog/archive/%d-%s.html'
);
$router->addRoute('blogArchive', $route);

谁能告诉我/%d,%s是什么意思? 例如,如果a有这样的代码:

$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')linke。谢谢!

1 个答案:

答案 0 :(得分:1)

%d表示数字,%s表示字符串。

[a-z,0-9,-]*是正则表达式。阅读更多here