Yaf_Route_Rewrite::assemble

(Yaf >=2.3.0)

Yaf_Route_Rewrite::assemble锟斤拷锟絬rl

说锟斤拷

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

锟斤拷锟斤拷指锟斤拷锟斤拷锟斤拷锟斤拷锟皆讹拷锟斤拷锟斤拷锟斤拷锟絩ewrite锟斤拷锟絩oute锟斤拷铣锟揭伙拷锟絬rl

锟斤拷锟斤拷

info

锟斤拷要锟斤拷锟斤拷一锟斤拷锟斤拷锟介,锟斤拷锟斤拷锟斤拷每锟斤拷key锟斤拷锟斤拷统锟绞硷拷锟絩ewrite route时$match锟斤拷锟斤拷锟叫的达拷冒锟脚的诧拷锟斤拷锟斤拷一锟斤拷

query

锟矫伙拷锟皆讹拷锟斤拷锟絨uery string锟斤拷锟斤拷锟斤拷锟捷达拷路锟缴癸拷锟斤拷拼锟斤拷锟斤拷url锟斤拷

锟斤拷锟斤拷

Example #1 Yaf_Route_Rewrite::assemble()example

router = new Yaf_Router();

$route  = new Yaf_Route_Rewrite(
                "/product/:name/:id/*",
                array(
                        'controller' => "product",
                ),
                array()
);

$router->addRoute("rewrite", $route);

var_dump($router->getRoute('rewrite')->assemble(
                        array(
                                ':name' => 'foo',
                                ':id' => 'bar',
                                ':tmpkey1' => 'tmpval1'
                        ),
                        array(
                                'tkey1' => 'tval1',
                                'tkey2' => 'tval2'
                             )
                        )
);

锟斤拷锟斤拷锟斤拷锟教碉拷锟斤拷锟斤拷锟斤拷锟斤拷冢锟�

string(57) "/product/foo/bar/tmpkey1/tmpval1/?tkey1=tval1&tkey2=tval2"

锟斤拷锟斤拷值