你好,我在paso2.php中有此代码,其功能是仅允许来自paso1.php
的输入,问题是如果我从http://localhost/referer/paso1.php
输入给我欢迎消息,但是如果我从http://localhost/referer/paso1.php?nombre=carlos&apellido=medina
输入,会向我发送错误消息“只能由paso1.php访问”
即使URL包含变量的参数,我也需要您允许我进入
<?php
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
if($referer !== 'http://localhost/referer/paso1.php'){
echo "Can only be accessed by paso1.php";
die();
}else{
echo "Entro desde paso1.php";
}
?>
谢谢