简体   繁体   English

Zend_Controller_Router_Route_Regex-请为我提供第四个参数

[英]Zend_Controller_Router_Route_Regex - please help me with the fourth parameter

I have this example: 我有这个例子:

    $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);

Can anyone tell me what /%d , %s means ? 谁能告诉我/%d,%s是什么意思? For example if a have a code like this: 例如,如果一个具有如下代码:

$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',

            )
    );

how can i write the last parameter ( 'blog/archive/%d-%s.html') linke in the example. 我如何在示例中编写最后一个参数('blog / archive /%d-%s.html')链接。 Thank you! 谢谢!

%d means digit and %s means string. %d表示数字, %s表示字符串。

[az,0-9,-]* is a regex. [az,0-9,-]*是一个正则表达式。 Read up more here . 在这里阅读更多内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM