如何获取请求引用路径? [英] How to get request referer path?

查看:24
本文介绍了如何获取请求引用路径?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要推荐人的路径.我不要域名.例如,如果推荐人是http://www.google.com/adsense 我想要 /adsense.

I need the path of the referrer. I don't want the domain name. For example, if the referrer is http://www.google.com/adsense I want /adsense.

推荐答案

request.referer 返回一个字符串,但您可以使用 Ruby 的 URI 模块 包装它,然后简单地询问它的路径:

request.referer returns a string, but you can use Ruby's URI Module to wrap it and then simply ask it for its path:

if URI(request.referer).path == '/adsense'

这篇关于如何获取请求引用路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆