Yet Another Framework Yaf_Route_Supervar::assemble
(Yaf >=2.3.0)
Yaf_Route_Supervar::assemble — Assemble a url
설명
public Yaf_Route_Supervar::assemble(array $info
, array $query
= ?): string
Assemble a url.
매개변수
info
query
반환 값
문자열을 반환합니다.
오류/예외
info
키 ':c'
및 ':a'
가 설정되지 않은 경우 Yaf_Exception_TypeError가 발생합니다.
Examples
예제 #1 Yaf_Route_Supervar::assemble() 예제
<?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',
1 => 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'"