我最近在我的網站上實現了一個具有登錄/用戶系統的文件管理器(FileGator),但我有一些麻煩試圖修改重定向代碼。我的登錄表單出現在每個頁面上,當前登錄的用戶會自動重定向到他瀏覽的同一頁面。登錄重定向的動態變量
事情是存在這樣的情況,我想我的用戶被重定向到其他地方一個特定的頁面,所以我想出了實際工作正常代碼:
// reload
if(isset($_REQUEST['redirect']) && ($_REQUEST['redirect'])!=='http://mywebsite.home/ftp/?login=1')
$url = $_REQUEST['redirect']; // holds url for last page visited.
else {
header('Location: '.gatorconf::get('base_url').'/?cd='); // default page
die;
}
header("Location:$url");
die;
與代碼我的用戶總是被重定向到
所以如果當前頁面的網址爲http://mywebsite.home/ftp/?login=1
,則相同的頁面將免除,在這種情況下,他將被重定向到「默認頁面」(如果用戶從文件管理器的登錄頁面登錄,則該頁面也是用戶重定向的pahe)。
但我想要的是,該網址http://mywebsite.home/ftp/?login=1
是「動態」有點像這樣:"base_url"/ftp/?login=1
,以便它可以在本地和無處不在我上傳它,它也將看起來更乾淨。
我嘗試使用文件管理器的代碼行('Location: '.gatorconf::get('base_url').'/?cd=')
這似乎自動得到我的基地網址。
我的嘗試:
// reload
if(isset($_REQUEST['redirect']) && ($_REQUEST['redirect'])!==(.gatorconf::get('base_url')./?login=1))
$url = $_REQUEST['redirect']; // holds url for last page visited.
else {
header('Location: '.gatorconf::get('base_url').'/?cd='); // default page
die;
}
header("Location:$url");
die;
}
也試過用的東西像一個$變量:
// reload
$default_redirect = .gatorconf::get('base_url').'/?login=1';
if(isset($_REQUEST['redirect']) && ($_REQUEST['redirect'])!==($default_redirect))
$url = $_REQUEST['redirect']; // holds url for last page visited.
else {
header('Location: '.gatorconf::get('base_url').'/?cd='); // default page
die;
}
header("Location:$url");
die;
}
但由於它可能是通過明顯,現在我不知道很多關於PHP和可以」即使經過一些研究,也找不到正確的方法。誰能幫我這個 ?
非常感謝