dongyu2764 2015-02-04 22:13
浏览 76
已采纳

锂重定向发送请求数据

Trying to build a controller method that can redirect and send the request data along with it. Controller/route redirect doesn't seem to have anything that can achieve this.

This question gave a new approach but I'm unable to figure out how to redirect to the specified page instead of rendering on the current.

$forward = Libraries::instance("controllers", "Main", [
     'request' => $this->request
]);
return $forward($this->request, ['action' => 'view']);

The route tests don't seem to provide any insight either, how can I go about achieving url redirect while still retaining the request data?

  • 写回答

1条回答 默认 最新

  • dqmhgz5848 2015-02-05 00:28
    关注

    From within a controller:

    $this->redirect(['AnotherController::anotherAction', '?' => $this->request->query], ['exit' => true]);
    

    $this->request->data can't be forwarded. Browser location redirects can only specify the query string. You could maybe render a page with a form that contains the data in input html elements and submit the form on load. Or you could stash the data in a session or somewhere server side and retrieve it on the next request.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度