0

我有这个参数链接:

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”

4

1 回答 1

0

您的所有参数都将被忽略,它们在您的 URL 中必须是唯一的
尝试使用这种方法http://example.com/article?id=571, 550, 276

if(isset($_GET['id'])){
print $_GET['id'];
}
于 2014-10-22T12:35:40.033 回答