我正在尝试在 yii 中以路径格式创建 URL,但它总是以 get 格式创建它。我不明白出了什么问题。
这是main.php
'urlManager'=>array(
'urlFormat'=>'path',
'showScriptName'=>FALSE,
'rules'=>array(
'airlineSearch/roundTripSearch/<origin:\w+>'=>'airlineSearch/roundTripSearch/<origin>',
'<controller:\w+>/<id:\d+>'=>'<controller>/view',
'<controller:\w+>/<action:\w+>/<id:\d+>'=>'<controller>/<action>',
'<controller:\w+>/<action:\w+>'=>'<controller>/<action>',
),
),
这是控制器
class AirlineSearchController extends Controller
{
public function actionRoundTripSearch($origin)
{
echo $origin;
}
public function actionLets()
{
echo $this->createUrl('roundTripSearch',array('origin'=>'delhi'));
}
}
但它总是会导致/services/airlineSearch/roundTripSearch?origin=delhi
问题:- 我怎样才能以路径格式获取它?