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条)

报告相同问题?

悬赏问题

  • ¥20 机器学习能否像多层线性模型一样处理嵌套数据
  • ¥20 西门子S7-Graph,S7-300,梯形图
  • ¥50 用易语言http 访问不了网页
  • ¥50 safari浏览器fetch提交数据后数据丢失问题
  • ¥15 matlab不知道怎么改,求解答!!
  • ¥15 永磁直线电机的电流环pi调不出来
  • ¥15 用stata实现聚类的代码
  • ¥15 请问paddlehub能支持移动端开发吗?在Android studio上该如何部署?
  • ¥20 docker里部署springboot项目,访问不到扬声器
  • ¥15 netty整合springboot之后自动重连失效