我有这个链接参数:
http://example.com/article?id=571&id=550&id=276
我希望得到所有的id值,形成一个数组并输出到一个字段,我已经尝试了几种方法,但没有一种方法,任何人都可以帮忙吗?感谢
if (isset($_GET['id'])){
// create an array to store all ids from the parameter
// Output each values in the array to $string variable
$form['submitted']['my_field']['#value'] = $string; // output all ids via this field.
}; //endif ;
我希望它会在现场输出:“571,550,276”
答案 0 :(得分:0)
您的所有参数都将被忽略,它们在您的网址中必须是唯一的
尝试使用此方法http://example.com/article?id=571, 550, 276
if(isset($_GET['id'])){
print $_GET['id'];
}