简体   繁体   中英

Empty referer on laravel Request::server('HTTP_REFERER')

I'm trying to get the previos page on laravel to check if it's coming from an outside web page, but the referer is empty

 public function index()
    {
        $referer = Request::server('HTTP_REFERER');

There is another way to know what is the previos visited page??

Your method is right, but you probably forget to use

use Illuminate\Http\Request;

Then you can use it on your controller like this

 $referer = Request::server('HTTP_REFERER');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM