0

我有这个例子:

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

4

1 回答 1

1

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

[a-z,0-9,-]*是一个正则表达式。在这里阅读更多。

于 2014-01-24T12:56:04.177 回答