在URL中传递javascript数组

ako*_*win 1 javascript php arrays codeigniter

如何在javascript中传递url中的数组?

我试过这个:

http://codeigniter/index.php/AssistanceMonitoringModule/assistanceMonitoring/getReport?remarks="+stat+"&sortBy="+sortBy+"&fromDate="+fromDate+"&toDate="+toDate+"&area="+area;

其中的备注是PHP中作为数组捕获的stat那个,并且是在...中提供的javascript数组remarks.那有什么解决方案吗?

每当一个时间捕获remarks我使用的PHP $this->input->get_post('remarks')(因为我使用codeigniter)我得到一个错误'为foreach()提供的无效参数

有你的帮助.:)

Fel*_*ing 5

您可以将数组编码为JSON,JSON.stringify并使用PHP对其进行解码json_decode.不要忘记使用encodeURIComponentURL中的值,否则您可能无法获得预期的URL.