dongpu1879 2015-08-28 12:39
浏览 87
已采纳

修改请求路径信息

Now, let me guess what y'all may be thinking... "It's a bad idea to modify the path info before it's processed. Why would you ever want to do that? This is malicious behavior!!!"

I am trying to get a controller/action representation of my previous URL; gotten through Yii::app()->getRequest()->getUrlReferrer().

From Yii 2 issues, it's possible to set the path info for a new request and parse that request. However, from the Yii 1 source, the only methods which deals with the path info are getPathInfo() and decodePathInfo(). If there was a setPathInfo(), I could have used that and the urlManager->parseUrl() to achieve this. But we aren't allowed to set the path info.

How can I arrive at a controller/action representation of my previous URL?

  • 写回答

2条回答 默认 最新

  • douhao3562 2016-03-21 11:32
    关注

    Yii does not allow the CHttpRequest object live past the parsing of the routes. And creating a new CHttpRequest is impossible after the app is created.

    I realized the only way to go about this is the vanilla Yii::app()->controller->action object. From this, I could get the module, controller and action ID for the specific URL.

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

报告相同问题?

悬赏问题

  • ¥15 单片机学习顺序问题!!
  • ¥15 ikuai客户端多拨vpn,重启总是有个别重拨不上
  • ¥20 关于#anlogic#sdram#的问题,如何解决?(关键词-performance)
  • ¥15 相敏解调 matlab
  • ¥15 求lingo代码和思路
  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 如何绘制动力学系统的相图