how to convert javascript array to php array

前端 未结 4 1573
轮回少年
轮回少年 2021-01-07 09:04

here is the code to convert javascript array to php array..... this is done with cookies...

function getCookie(c_name)
{
var i,x,y,ARRcookies=document.cookie         


        
4条回答
  •  [愿得一人]
    2021-01-07 09:26

    In JS:

    var a, s;
    a = [ 'one', 'two', 'three'];
    s = JSON.stringify( a );
    
    //Do something to send `s` to the server in a request
    

    In PHP, assuming s came from client in a cookie

    Simple as that.

提交回复
热议问题