简体   繁体   中英

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 ? 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. Thank you!

%d means digit and %s means string.

[az,0-9,-]* is a regex. Read up more here .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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