(Yaf >=2.3.0)
Yaf_Route_Map::assemble — 组合url
根据指定参数和自定义参数将 map 这个 route 组合成一个 url
可能抛出 Yaf_Exception_TypeError。
示例 #1 Yaf_Route_Map::assemble() 示例
<?php
$router = new Yaf_Router();
$route = new Yaf_Route_Map();
$router->addRoute("map", $route);
var_dump($router->getRoute('map')->assemble(
array(
':c' => 'foo_bar'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
)
);
$route = new Yaf_Route_Map(true, '_');
$router->addRoute("map", $route);
var_dump($router->getRoute('map')->assemble(
array(
':a' => 'foo_bar'
),
array(
'tkey1' => 'tval1',
'tkey2' => 'tval2'
)
)
);
以上示例的输出类似于:
string(%d) "/foo/bar?tkey1=tval1&tkey2=tval2" string(%d) "/foo/bar/_/tkey1/tval1/tkey2/tval2"