Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/87.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将数组传入PHP服务器的数组?_Php_Jquery_Html_Symfony - Fatal编程技术网

如何将数组传入PHP服务器的数组?

如何将数组传入PHP服务器的数组?,php,jquery,html,symfony,Php,Jquery,Html,Symfony,我的html视图中有下一个多字段: <select multiple="multiple" name="search[cpuUsage[]]" id="search_cpu_usage" class="form-control"> {% for statu in status %} <option value="{{ statu }}">{{ statu }}</option> {% endfor %} <

我的html视图中有下一个多字段:

<select multiple="multiple" name="search[cpuUsage[]]"
    id="search_cpu_usage"
    class="form-control">
    {% for statu in status %}
        <option value="{{ statu }}">{{ statu }}</option>
    {% endfor %}
</select> 

{状态为%的状态为%}
{{status}}
{%endfor%}
我需要用户选择的所有可能值,并尝试在
search[cpuUsage[]]
中保存,但这不起作用,因为
php
只获取最后选择的值。如果我只使用
cpuUsage[]
而不使用
search[]
则效果很好

对于发送到服务器,我使用
jquery.serialice


关于如何进行工作
搜索[cpuUsage[]

您需要将
名称
属性作为数组

所以改变

name="search[cpuUsage[]]"
致:-


你很好去

cpuUsage[]
已经是一个数组了为什么你需要
搜索
数组?
name="search[cpuUsage][]" //or name="search[]" or name="cpuUsage[]"