How does PHP determine the user's access method, whether it is accessed by the src of the image?
巴扎黑
巴扎黑 2017-06-05 11:08:06
0
3
705

How does the php language determine the user's access method?
The scenario is as follows:
I want to display different content by determining the user's access method to this address. If accessed through the image src, the image will be displayed. If it is accessed through the image src, the image will be displayed. The browser directly accesses and displays the web page information

巴扎黑
巴扎黑

reply all(3)
漂亮男人

Accept can be judged by the Accept header information of the request. The browser request will bring text/html | application/xhtml+xml | application/xml similar information, of which text/html will definitely have it, and the img tag will src will not have text/html request type

左手右手慢动作

You can determine whether the Referer in the HTTP request header, that is, the $_SERVER['HTTP_REFERER'] in PHP, is empty.

Generally, if it is empty, it means that you can directly enter the image address to open it.

instead of empty is generally opened through the <img> tag.

Of course the only exception is when this user right-clicks on this <img> tag to view the image in a new tab.

phpcn_u1582

Add a parameter in the access url, which is used to determine the user's access method. It’s that simple

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template