小编Zac*_*Zac的帖子

检索tmpfile()的路径

匆匆...

有没有办法检索由tmpfile()?创建的文件的路径?

或者我需要自己做tempnam()吗?

php

57
推荐指数
1
解决办法
3万
查看次数

通过ajax到PHP的多维数组

好认真在这里挣扎.我试图通过ajax向PHP发送多维数组时遇到一些问题.这是我一直在尝试的:

为了简化而不是复制粘贴代码墙:

    peoplearray[0]  =  [name] => 'john'
                       [age]  => '28'
                       [sex]  => 'Male'
    peoplearray[1]  =  [name] => 'julie'
                       [age]  => '20'
                       [sex]  => 'Female'

    main_array['item'] = 'x';
    main_array['something'] = 'x';
    main_array['another'] = 'x';
Run Code Online (Sandbox Code Playgroud)

我希望通过这个获得这个post.我想我也可以将它们加在一起,因为我是多维的,因此:

    main_array['peoplearray'] = peoplearray;
Run Code Online (Sandbox Code Playgroud)

现在要做ajax:

// var data = JSON.stringify(main_array);

var send = $.ajax({
        type: "POST",
        cache: false,
        url: "theurl",
        data: {data:main_array} //I do change this `main_array` when using the above stringify!
});


send.done(function(msg) {
console.log(msg);
})
Run Code Online (Sandbox Code Playgroud)

在PHP中,我现在正在执行以下操作:

$data= $_POST['data'];
print_r($data);
Run Code Online (Sandbox Code Playgroud)

在萤火虫: (an empty string) …

javascript php arrays jquery

6
推荐指数
2
解决办法
1万
查看次数

标签 统计

php ×2

arrays ×1

javascript ×1

jquery ×1