Php 使用动态href时如何从url中删除参数?
使用传递参数Php 使用动态href时如何从url中删除参数?,php,.htaccess,http,Php,.htaccess,Http,使用传递参数 $n=isset($_GET['page']) ? (int)$_GET['page'] : 0; echo('<a href="?page='.($n+1).'">Next</a>'); 如何从url或make中删除参数&*.php文件名 "home/browse/" ? 在根目录中添加.htaccess: 重新启动发动机 重写cond%{REQUEST_FILENAME}-d 重写cond%{REQUEST_FILENAME}-f 重写cond%{
$n=isset($_GET['page']) ? (int)$_GET['page'] : 0;
echo('<a href="?page='.($n+1).'">Next</a>');
如何从url或make中删除参数&*.php文件名
"home/browse/" ?
在根目录中添加.htaccess: 重新启动发动机 重写cond%{REQUEST_FILENAME}-d 重写cond%{REQUEST_FILENAME}-f 重写cond%{REQUEST_FILENAME}-l 重写规则^(+)$index.php?MyVar=$1[QSA,L] 您可以在examle的代码中使用用户
$\u获取['MyVar']
:
$MyVar = isset($_GET['MyVar'])? $_GET['MyVar'] : 'Nop' ;
$Arr= explode('/',$MyVar) ;
之后,您就可以在数组中的requst数组上使用重写引擎了。为什么不使用.htaccess来避免它呢
<IfModule mod_rewrite.c>
Options +FollowSymLinks
#enter code here
IndexIgnore */*
# Turn on RewriteEngine
RewriteEngine On
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</IfModule>
选项+FollowSymLinks
#在这里输入代码
IndexIgnore*/*
#打开发动机
重新启动发动机
#规则
重写cond%{REQUEST_FILENAME}-F
重写cond%{REQUEST_FILENAME}-D
重写规则。index.php
<IfModule mod_rewrite.c>
Options +FollowSymLinks
#enter code here
IndexIgnore */*
# Turn on RewriteEngine
RewriteEngine On
# Rules
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . index.php
</IfModule>