js传送字符串数组到php

WBOY
Release: 2016-06-13 12:32:13
Original
1270 people have browsed it

js传递字符串数组到php
为什么从js传递的字符串数组在php中变成了一个字符串,ajax传递的,代码如下:
js端:
var selected = new Array('1','2');
JSON.stringify(selected);
post....

php端:
$selected = json_decode($_POST['selected']);
这样写$selected是空的 
$selected = $_POST['selected'];
这样的话$selected便是一个字符串,我要的是数组。

求助各位了,折腾好久了。。。

js php
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!