$_SESSION['user']='zhangsan';
return header('location:.. iew/newfile.php');或使用$request那个更好???我仅仅想传递一个二维数组。。怎么做更好???

解决方案 »

  1.   

    1.herder是不需要return的
    2.你可以把数据做成json(json_encode)格式的或者你把而为数组序列化一下(serialize)
      

  2.   

    用serialize将你的数组转成字符串传递就可以了。
      

  3.   

    $arr = array(1,2);
    $url ="xxx.php?arg=".json_encode($arr);header("location:".$url);
      

  4.   

    json_encode 也可以换成serialize,反正只要传递过去时字符串你能将它还原就行了
      

  5.   

    PHP手册上的例子:
    $_session_data是一个多维数组
    <?php
    // $session_data contains a multi-dimensional array with session
    // information for the current user.  We use serialize() to store
    // it in a database at the end of the request.$conn = odbc_connect("webdb", "php", "chicken");
    $stmt = odbc_prepare($conn,
          "UPDATE sessions SET data = ? WHERE id = ?");
    $sqldata = array (serialize($session_data), $_SERVER['PHP_AUTH_USER']);
    if (!odbc_execute($stmt, $sqldata)) {
        $stmt = odbc_prepare($conn,
         "INSERT INTO sessions (id, data) VALUES(?, ?)");
        if (!odbc_execute($stmt, $sqldata)) {
            /* Something went wrong.. */
        }
    }
    ?>