网址为http://www.test.co.uk/?set_cp_city=thecity
,通常我可以使用$_GET['set_cp_city']
但这不起作用。也许与wordpress有关。那么,如何获得价值参数set_cp_city
获取网址的具体参数
Here'ss我的代码
<select onChange="window.location.href=this.value">
<?php
$locations = array("London","Bristol","Manchester","Kent","Essex","Lancashire","Bedfordshire","Berkshire","Buckinghamshire","Cambridgeshire","Cheshire","Cornwall","County Durham","Cumbria","Derbyshire","Devon","Dorset","East Yorkshire","East Sussex","Gloucestershire","Hampshire","Herefordshire","Hertfordshire","Isle of Wight","Leicestershire","Lincolnshire","Merseyside","Norfolk","North Yorkshire","Northamptonshire","Northumberland","Nottinghamshire","Oxfordshire","Rutland","Shropshire","Somerset","South Yorkshire","Staffordshire","Suffolk","Surrey","Tyne and Wear","Warwickshire","West Midlands","West Sussex","West Yorkshire","Wiltshire","Worcestershire");
$current_city = $_GET['set_cp_city'];
echo "<option>$current_city</option>";
foreach($locations as $value) {
?>
<option value="http://www.test.co.uk/?set_cp_city=<?php echo $value ?>"><?php echo $value ?></option>
<?php
}
?>
</select>
检查你的'.htaccess',看看是否内部存在'[QSA]'。如果不行,你可能需要在'ReWrite *'行之后添加它。 – Gary 2014-11-06 11:07:12