(唔識點形容)...點用PHP做到個URL好似個FOLDER咁

編寫、設計網頁與程式。

版主: hamu278, 銘仔

版面規則
  • 本版面亦可以討論網頁寄存公司

(唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章Freeman » 2008-10-01, 00:44

Freeman
地球會員
 
文章: 1680
註冊時間: 2008-06-25, 21:04

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章bananasims » 2008-10-01, 00:49

.htaccess
影像.從心 At the heart of the ímage
bananasims
太陽會員
 
文章: 13541
註冊時間: 2005-09-22, 00:00

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章銘仔 » 2008-10-01, 00:52

bananasims 寫:.htaccess

Rewrite Rule xD.
頭像
銘仔
金星會員
 
文章: 3017
註冊時間: 2007-04-05, 20:36

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章Freeman » 2008-10-01, 00:57

睇過Drupal果個,唔係好明
同埋Word Press好似唔駛.htaccess既?

舉個例子
如果
www.xxx.com/index.php?value=phpbb --->> www.xxx.com/phpbb
應該點?
Freeman
地球會員
 
文章: 1680
註冊時間: 2008-06-25, 21:04

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章銘仔 » 2008-10-01, 00:59

頭像
銘仔
金星會員
 
文章: 3017
註冊時間: 2007-04-05, 20:36

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章Freeman » 2008-10-01, 01:09



代碼: 選擇全部
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>


呢PART?
唔係好明段CODE既意思
Freeman
地球會員
 
文章: 1680
註冊時間: 2008-06-25, 21:04

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章Lemon233 » 2008-10-01, 01:38

Rewrite我之前都玩過下,不過要搞regexp好鬼煩咁解...
升上大學之後, 我們一起回老家結緍吧
幹嘛無故立旗...
頭像
Lemon233
地球會員
 
文章: 972
註冊時間: 2008-05-12, 15:53
來自: 澳門仔一名

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章Puff » 2008-10-01, 02:05

iamfreeman 寫:


代碼: 選擇全部
<IfModule mod_rewrite.c>
  RewriteEngine on
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
</IfModule>


呢PART?
唔係好明段CODE既意思

塞呢段落 .htaccess

然後 PHP 用 $_SERVER['REQUEST_URI'] 讀 URI

然後用你既 PHP 知識將 URL 拆解成你要既Data啦
Wholehearted plastics are stranger than fiction.
Puff
木星會員
 
文章: 343
註冊時間: 2008-08-30, 05:22

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章bananasims » 2008-10-01, 08:10

I-Circle SiteBuilder 有拆網址既編碼。
影像.從心 At the heart of the ímage
bananasims
太陽會員
 
文章: 13541
註冊時間: 2005-09-22, 00:00

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章Freeman » 2008-10-01, 16:47

.htaccess
代碼: 選擇全部
RewriteEngine On
RewriteBase /
RewriteRule ^(.+)$ test/$1?%{QUERY_STRING}


include/common.php
代碼: 選擇全部
define('REQUESTURI', htmlspecialchars($_SERVER['REQUEST_URI']));


上面係IC搵左之後加入去既
但點解會出現
代碼: 選擇全部
Not Found

The requested URL /test/index.php was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.


test入面已經有index.php
Freeman
地球會員
 
文章: 1680
註冊時間: 2008-06-25, 21:04

Re: (唔識點形容)...點用PHP做到個URL好似個FOLDER咁

文章Freeman » 2008-10-02, 00:23

成功 :D
多謝以上咁多位
Freeman
地球會員
 
文章: 1680
註冊時間: 2008-06-25, 21:04


回到 [B1] 網頁製作、程式編寫與介面設計



誰在線上

正在瀏覽這個版面的使用者:沒有註冊會員 和 14 位訪客

cron