如何从钛发送多维数组到PHP

时间:2014-04-17 06:44:12

标签: javascript php arrays titanium-alloy

var send = Ti.Network.createHTTPClient({

        onerror : function(e) {

            Ti.API.debug(e.error);

            alert('There was an error during the connection');  
        },      
});

send.open('POST', 'abc.php');   

var data = Ti.App.Properties.getList('cart'); 

//data containing js array object: 

i.e:[{"key":"5736","quantity":"1","product_name":"Fruit Raita","price":"75.00"},{"key":"11454","quantity":"2","product_name":"Veg. Harabhara Kabab","price":"90.00"}]

send.send({             

      products:JSON.stringify(data),        
});

//现在如何在php中检索这个数组?

我试过以下事情:

1)json_decode($_POST['products']);

2)var_dump

3)json_decode(stripslashes($_POST['products']));

我怎么能在php中使用这个数组?

0 个答案:

没有答案