Home  >  Article  >  Backend Development  >  请问:PHP 一个页面怎样必须从指定的页面链接进入,不能直接输入地址进入

请问:PHP 一个页面怎样必须从指定的页面链接进入,不能直接输入地址进入

WBOY
WBOYOriginal
2016-06-13 13:35:371460browse

请教:PHP 一个页面怎样必须从指定的页面链接进入,不能直接输入地址进入?
请教:PHP 一个页面怎样必须从指定的页面链接进入,不能直接输入地址进入?

B页面必须通过A页面进入

------解决方案--------------------
你是从A页面跳到B页面,如果在php需要有必须传的参数,值 那么你可以对这个值($_POST[])进行判断,有的话做处理,没有就做location跳转或者404.
如果没有必须的参数,你可以人为的给个参数。
用session也有办法的 不过比较麻烦。

$_SERVER['HTTP_REFERER'] 
引导用户代理到当前页的前一页的地址(如果存在)。由 user agent 设置决定。并不是所有的用户代理都会设置该项,有的还提供了修改 HTTP_REFERER 的功能。简言之,该值并不可信。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn