Home  >  Q&A  >  body text

form表单里面如果有两个相同的name,传过去得到的name值只有一个,我就想要得到两个值怎么办,求助

form表单里面如果有两个相同的name,传过去得到的name值只有一个,我就想要得到两个值怎么办,求助

phpcn_u806phpcn_u8062769 days ago1250

reply all(2)I'll reply

  • 数据分析师

    数据分析师2017-10-01 00:56:20

    If there are two identical names in the form, and there is only one name value passed in, what should I do if I want to get two values? Help - PHP Chinese Q&A - If there are two identical names in the form name, there is only one name value after passing it. I want to get two values. What should I do? Please help - PHP Chinese website Q&A

    Take a look and learn.

    reply
    0
  • 阿神

    阿神2017-03-21 17:27:41

    <input name="name[]" value="1"/>
    <input name="name[]" value="2"/>

    query stringify后效果是

    name%5B%5D=1&name%5B%5D=2

    query parse之后在Js中是一个Array, 在PHP中是一个Indexed Array, 在Python中是一个list.

    reply
    0
  • Cancelreply