通过HTTP GET传递数组 [英] Pass array with keys via HTTP GET
本文介绍了通过HTTP GET传递数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我试图通过请求将数组数据传递给PHP脚本:
I have tried to pass array data to the PHP script with request:
script.php?page=7&filter[key]=value
但在脚本中没有收到。我可以这样做,如果没有 - 我怎么能传递数组与HTTP GET?
but didn't receive it in the script. Can I do so and if no - how can I pass array with HTTP GET?
推荐答案
以获得在PHP页面上的值,
You can definitely pass array from url and to get the value on php page,
$testvar = $_GET['filter'];
echo $testvar['key'];
只是出于好奇,我尝试过 $ _ GET ['filter'] ['value']
并且它也可以工作!!!
and just out of curiosity i tried to $_GET['filter']['value']
and it too worked !!!
如果您想传递多个数组val,可以使用 http_build_query
and if you want to pass multiple array vals, you can use http_build_query
这篇关于通过HTTP GET传递数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文