我正在本地服务器上的一个站点上工作 . 我已经制作了一个表格来搜索国家,州和城市 . 获得结果后,我看到格式为URL的URL
我想将此网址设为URL
所以我想知道URL管理器规则,以便我可以按照自己的意愿制作 .
只需在您的网址管理器中添加此规则即可
"site/searchme/<country>/<state>/<city>" => "site/searchme"
现在,您需要使用此签名进行操作:
public function actionSearchme($country, $state, $city)
您可以在此操作中从url访问 $country , $state , $city . 例如,如果您的网址如 http://localhost/yii_1/site/searchme/UnitedStates/Washington/NewYork , $country 将等于"UnitedStates",依此类推 .
$country
$state
$city
http://localhost/yii_1/site/searchme/UnitedStates/Washington/NewYork
1 回答
只需在您的网址管理器中添加此规则即可
现在,您需要使用此签名进行操作:
您可以在此操作中从url访问
$country
,$state
,$city
. 例如,如果您的网址如http://localhost/yii_1/site/searchme/UnitedStates/Washington/NewYork
,$country
将等于"UnitedStates",依此类推 .