ds355020 2010-04-21 19:44
浏览 482
已采纳

如何在PHP中将多维数组作为GET参数传递?

I have the following code.

$connect  = new Connection ();
$response = $connect->putFile($fileName, $destination);
header("Location: /test.php?response=" . $response);

When I invoke header with the response, the file will stop execution, but I will have no error in the console... I am thinking maybe this array needs to be encoded for the url?

if that is the case how?

Thank you

  • 写回答

2条回答 默认 最新

  • drjyvoi734793 2010-04-21 19:49
    关注

    If $response is a multi-dimensional array, you may fare best by serialize()ing it and urlencode() ing the result. It adds some overhead but not too much.

    However, transporting data through GET is seriously limited. The amount of data should not exceed 1-2 kilobytes. Source: For example here

    If your data is likely to exceed that limit, you should think about either transporting the data through POST or, if that's not possible, in a session or other kind of persistent storage.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 求差集那个函数有问题,有无佬可以解决
  • ¥15 【提问】基于Invest的水源涵养
  • ¥20 微信网友居然可以通过vx号找到我绑的手机号
  • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
  • ¥15 解riccati方程组
  • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
  • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
  • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
  • ¥50 树莓派安卓APK系统签名
  • ¥65 汇编语言除法溢出问题