Passing arrays as url parameter

前端 未结 10 1766
礼貌的吻别
礼貌的吻别 2020-11-22 12:32

What is the best way that I can pass an array as a url parameter? I was thinking if this is possible:

$aValues = array();

$url = \'http://www.example.com?a         


        
10条回答
  •  失恋的感觉
    2020-11-22 12:36

    **in create url page**
    
    $data = array(
            'car' => 'Suzuki',
            'Model' => '1976'
            );
    $query = http_build_query(array('myArray' => $data));
    $url=urlencode($query); 
    
    echo" 

    Send

    "; **in received page** parse_str($_GET['data']); echo $myArray['car']; echo '
    '; echo $myArray['model'];

提交回复
热议问题