开发者

What does `$_SERVER['HTTP_REFERER']` mean in PHP?

开发者 https://www.devze.com 2023-02-07 03:30 出处:网络
$_SERVER[\'HTTP_REFERER\'] What does this store? I\'m doing some MySQL using PHP with the POST method of a form.
$_SERVER['HTTP_REFERER']

What does this store? I'm doing some MySQL using PHP with the POST method of a form.

In my case I'm using this form

<form action="http://localhost/db/db.php" method="post">
<table>
<tr>
<td>Name:</td>
<td>
<input type="text" name="Name" value="" maxlength="100" />
</td>
</tr>
</table>
<input type="submit">
</for开发者_如何学Cm>

But in my db.php it does not give me any value to $_SERVER['HTTP_REFERER']


This stores http://en.wikipedia.org/wiki/HTTP_referrer value.

Means that it stores host of previous site that user use before yours


ok its pretty easy, firstly the HTTP_REFERER is not a php only thing. Its a web server thing IIS has the exact same server variable.

think of it like this, when ever a client does a request to a php page, the server collects some data, the client also sends some data. These so-called server variables are a collection of the available data in the request. I would recommend checking out not just this server variable, but infact all server variables. You'll be surprised what data you can access, for example the client screen size, browser, operating system.

I'm sure someone will post the exact technical meaning of a server variable, but this overview I've given should set you straight.


This tells you the URL of the page that your script is being invoked from.

So, say you went to http://google.com, then navigated to your script's URL, for the lifetime of your script, the value stored in $_SERVER['HTTP_REFERER'] would be http://google.com


This (usually) stores the URI which user came from to your page.

0

精彩评论

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