0
我有一個看起來像網址:的.htaccess重寫用GET參數的URL使用PHP
search.php?tmp=Hello&A=&B[]=12&B[]=14&vars=100
OR
search.php?tmp=Hello&A=&B[]=1&B[]=14&B[]=4785&vars=100&cat=PC
(參數並不穩定) ,我想是這樣的:
search/Hello/&A=&B[]=12&B[]=14&vars=100
search/Hello/&A=&B[]=1&B[]=14&B[]=4785&vars=100&cat=PC
我試過,它工作正常
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase/
# internal forward
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.+?)/(.+?)/(.+?)\/?$ search.php?tmp=$1&$2 [NC]
# external rewrite
#RewriteCond %{THE_REQUEST} search\.php\?tmp=([^\s]+) [NC]
#RewriteRule^/search/%1? [R=302,L]
RewriteCond %{THE_REQUEST} /search\.php\?tmp=([^\s&]+)&(.*) [NC]
RewriteRule^/search/%1/%2? [R=302,L]
</IfModule>
問題我想用GET方法獲取相同的參數。 但是print_r($ _ REQUEST)的輸出;
Array ([tmp] => search [hello] =>)
我想有一個像
Array ([tmp] => Hello [A] => [B] => Array ([0] => 1 [1] => 14 [2] => 4785) [vars] => 100)
輸出誰能幫助我?謝謝。