在线文档教程
PHP
Yaf

Yaf_Route_Map::assemble

Yaf_Route_Map::assemble

(Yaf >=2.3.0)

Yaf_Route_Map::assemble - 组装一个url

描述

public string Yaf_Route_Map::assemble ( array $info [, array $query ] )

组装一个url。

参数

info query

示例

示例#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"

返回值

← Yaf_Route_Map

Yaf_Route_Map::__construct →