doufu9947 2016-04-05 12:10
浏览 29
已采纳

如何在Zend Framework中获取HTTP_REFERER

I tried to use this solution, but it doesn't work for me. My $this doesn't have getRequest() method and Zend\Http\Request doesn't have it too at all.

I tried something like

$request = new \Zend\Http\Request();
$http_referer = $request->getHeader('referer');

but it returns just boolean false. What I'm missing?

  • 写回答

1条回答 默认 最新

  • doume5227 2016-04-05 12:14
    关注

    Got it, I'm using the wrong class. We need to use \Zend\Http\PhpEnvironment\Request() This one is correct:

    $request = new \Zend\Http\PhpEnvironment\Request();
    $http_referer = $request->getServer('HTTP_REFERER');
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 素材场景中光线烘焙后灯光失效
  • ¥15 请教一下各位,为什么我这个没有实现模拟点击
  • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
  • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 保护模式-系统加载-段寄存器