Yaf_Route_Supervar::assemble

(Yaf >=2.3.0)

Yaf_Route_Supervar::assemble锟斤拷锟絬rl

说锟斤拷

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

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

锟斤拷锟斤拷

info

锟斤拷要锟斤拷锟斤拷一锟斤拷锟斤拷锟介,锟斤拷锟斤拷锟斤拷每锟斤拷key锟斤拷为:m锟斤拷:c锟斤拷:a锟斤拷:m锟斤拷锟斤拷module锟斤拷:c锟斤拷锟斤拷controller, :a锟斤拷锟斤拷action

query

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

锟斤拷锟斤拷

Example #1 Yaf_Route_Supervar::assemble()example

<?php

$router 
= new Yaf_Router();

$route  = new Yaf_Route_Supervar('r');

$router->addRoute("supervar"$route);

var_dump($router->getRoute('supervar')->assemble(
        array(
              
':a' => 'yafaction',
              
'tkey' => 'tval',
              
':c' => 'yafcontroller',
              
':m' => 'yafmodule'
        
),
        array(
              
'tkey1' => 'tval1',
              
'tkey2' => 'tval2'
        
)
));

try {
var_dump($router->getRoute('supervar')->assemble(
        array(
              
':a' => 'yafaction',
              
'tkey' => 'tval',
              
':m' => 'yafmodule'
        
),
        array(
              
'tkey1' => 'tval1',
              
'tkey2' => 'tval2',
              
=> array(),
        )
));
} catch (
Exception $e) {
    
var_dump($e->getMessage());
}

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

string(%d) "?r=/yafmodule/yafcontroller/yafaction&tkey1=tval1&tkey2=tval2"
string(%d) "You need to specify the controller by ':c'"

锟斤拷锟斤拷值