开发者

How to get request referer path?

开发者 https://www.devze.com 2023-03-01 13:19 出处:网络
I need the 开发者_如何学Cpath of the referrer. I don\'t want the domain name. For example, if the referrer is

I need the 开发者_如何学Cpath 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 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'


You can access referer with

request.referer
0

精彩评论

暂无评论...
验证码 换一张
取 消