我正在嘗試編寫一個檢查程序,以便根據用戶通過網站註冊過程的進度來重定向用戶。我有這樣的:
來自PHP頭的奇怪行爲()
if($user = VRComponent::getLogin()) {
if(VR::exists('vr_user','Signup',"userID={$user->ID}")) {
$step = VR::select('vr_user','Signup',"userID={$user->ID}");
$step = intval($step[0]['step']);
if(!isset($_GET['step']) || $step != intval($_GET['step'])) {
switch($step) {
case 1: header("Location: /signup/one"); exit; break;
case 2: header("Location: /signup/two"); exit; break;
case 3: header("Location: /signup/three"); exit; break;
case 4: header("Location: /signup/four"); exit; break;
}
}
} else {
header("Location: /account");
exit;
}
} else {
header("Location: /");
exit;
}
的存在和選擇功能基本上只是別名MySQL的功能。
基本上這會檢查用戶是否已登錄。如果是,它將檢查他們是否已完成註冊過程。如果不是,它會檢查是否傳遞的「頁面」實際上是它們所在的最後一頁。如果沒有,它會將它們重定向到正確的頁面。
邏輯工作,但是頁面引用的所有外部js和css文件不加載。奇怪的是,他們不扔了404,而不是文件的唯一內容是:
Failed to load source for: https://domain.com/path/to/file/style.css
另一個奇怪的是,即使在if語句的條件是虛假的文件不加載。註釋掉switch語句(即使if條件爲false)允許加載文件,但當然邏輯將不正確。
我覺得它非常簡單,但我只是沒有看到它。我即將把我的拳頭放在監視器上,因爲這種行爲對我來說毫無意義。
在此先感謝
-D
你可以休息;退出後; – dynamic 2011-03-04 21:14:19