「functions.php」というファイル内に保存されたこのコードがあります
$host = $_SERVER['HTTP_HOST'];
$folder = rtrim(dirname($_SERVER['PHP_SELF']),'/\\');
function redirect_to_home(){ /*function to redirect the user ot his profile page, or admin page if he is an administrator*/
if(admin_class::isadmin()){
header("Location:http://$host$folder//adminindex.php");
exit();
}
else{
header("Location:http://$host$folder/profile.php");
exit();
}
}
function redirect_to_welcome(){
header("Location:http://$host$folder/index.php");
exit;
}
function redirect_to_loan(){
header("Location:http://$host$folder/loan.php");
exit;
}
ウェブサイト自体をブラウジングするとき、これらは正しく機能せず、ウェブサイト内のリンクを介してしか移動できませんでしたlocalhost
. .php") 私が開発していたとき)。
ここでいくつかの啓蒙が必要です。私はこの Web サイトを LAN 経由で立ち上げており、接続されている人は xxx.xxx.xxx.x/YMMLS 経由でアクセスできます。しかしもちろん、これらの関数のいずれかが呼び出されると、Web サイトは適切にリダイレクトされません。
前もって感謝します、