php 頁面跳轉 本土windows 環境正常,上傳linux 伺服器上跳轉不了

來源:互聯網
上載者:User
php 頁面跳轉 本地windows 環境正常,上傳linux 伺服器上跳轉不了
php 做的一個下項目,登入後頁面跳轉到首頁,在本地的Windows 環境是正常的,上傳到linux伺服器上就跳轉不了。求解答。
代碼,項目結構如下:

action/loginin.php
//user login
if (isset($_POST['username']) && isset($_POST['password'])
&& !empty($_POST['username']) && !empty($_POST['password'])
) {
try{
$username = $_POST['username'];
$password = $_POST['password'];
$rs = $config[DAOIMPL]->getLoginByName($username);
$arr = mysql_fetch_array($rs);
//echo $arr['sys_user_passwd'];
if ($arr && $arr['sys_user_passwd'] == generateUserPassword($password)) {
$_SESSION[SESSIONUSER] = $username;
echo '';//跳轉到根目錄下的index.php
}else {
echo "";
exit(0);
}
}
catch (Exception $e){
echo "";
exit(0);
}
}





另外伺服器是 作業系統:Ubuntu 12.04 64位
------解決方案--------------------
重新回到登入介面 不一定是你沒有跳轉到index.php,有可能是你的session沒有註冊成功,到index.php又轉到login.php了。
------解決方案--------------------
有可能是你的session沒有註冊成功,到index.php頁面之後,判斷沒有登入,又往登入介面跳轉了。你先屏蔽index.php的跳轉功能試試看。
------解決方案--------------------
if (isset($_POST['username']) && isset($_POST['password']) && !empty($_POST['username']) && !empty($_POST['password'])) {
$username = $_POST['username'];
$password = $_POST['password'];
$rs = $config[DAOIMPL]->getLoginByName($username);
$arr = mysql_fetch_array($rs);
if ($arr && $arr['sys_user_passwd'] == generateUserPassword($password)) {
$_SESSION[SESSIONUSER] = $username;
echo '';
echo '';
}else {
echo "";
}
}
如果登入成功,會彈出“驗證成功”對話方塊,你有嗎?
------解決方案--------------------
引用:
Quote: 引用:

有可能是你的session沒有註冊成功,到index.php頁面之後,判斷沒有登入,又往登入介面跳轉了。你先屏蔽index.php的跳轉功能試試看。


session已經設定成功,屏蔽掉index.php的跳轉後,程式就停在了logininphp


從你貼出來的loginin.php代碼和運行情況來看,是不可能往 錄介面跳轉 跳轉的,對吧? 屏蔽掉index.php的跳轉後,程式就不再往登入介面跳轉,這也就說明了一些問題。

你再在index.php最前面輸出一些資訊,看看情況如何?
------解決方案--------------------
那就是你沒有 session_start() 了
------解決方案--------------------
輸出session看看有什麼東西?
  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.