一個比較簡單的問題

來源:互聯網
上載者:User
看到一個網站
http://www.*****.com/
登陸進去後,網址欄上顯示
http://www.*****.com/user
想問一下,它是用的哪一個檔案顯示的,剛剛接觸php.

謝謝。


回複討論(解決方案)

index.php 部分

if(user_is_login_in){
header("location:dirname(__FILE__).'/user.php"); //如果使用者已登入,跳轉到user.php
}else{
//主代碼
}

.htacess 部分


RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^/]+)/ $1.php [L,QSA]
#去掉.php尾碼名 http://www.*****.com/user.php 定向為 http://www.*****.com/user

index.php 部分

if(user_is_login_in){
header("location:dirname(__FILE__).'/user.php"); //如果使用者已登入,跳轉到user.php
}else{
//主代碼
}

.htacess 部分


RewriteEn……
補充一下,user也有可能是個目錄

user 是個目錄

使用者經過驗證後,執行 echo tiaos("/user/");

有一個函數
function tiaos($url){
$key="";
return $key;
}

也有可能是MVC架構,user控制器

好幾種方法能做到。
1. 自己弄個簡單跳轉
2. URL Rewrite
3. framework

看到一個網站
http://www.*****.com/
登陸進去後,網址欄上顯示
http://www.*****.com/user
想問一下,它是用的哪一個檔案顯示的,剛剛接觸php.

謝謝。 一般情況下的話,是登陸成功後, 在驗證登陸成功的function中會有跳轉到http://www.*****.com/user,用到的php函數可能是header()。

index.php

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在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.