在URL中为同一个GET变量传递多个值 [英] Passing multiple values for same GET variable in URL
问题描述
http是一种更简洁的方法://www.mysite.com/somepage?tags [] = one& tags [] = two& tags [] = three
我想过以下几点:
http://www.mysite.com/somepage? tags = one,two,three
然后使用 想知道是否有人看到或使用过更好的解决方案吗? 我会说使用 I'm wondering if there is a cleaner way to pass multiple variables in a GET request than the following: I had thought about the following: Then using Wondered if anyone had seen or used a better solution though? Using I'd say it's safer to use 这篇关于在URL中为同一个GET变量传递多个值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋! explode()$
explode()
是唯一可靠的,如果每个标签的值永远不会包含任何字符串你会爆炸(在这种情况下是,)。
tags [] = X&标记更安全[] = Y
。http://www.mysite.com/somepage?tags[]=one&tags[]=two&tags[]=three
http://www.mysite.com/somepage?tags=one,two,three
explode()
to separate them.explode()
is only reliable if the values of each tag will never contain whatever string it is you're exploding by (in this case ",").tags[]=X&tags[]=Y
.