服务器请求uri修剪参数(server request uri trimming parameters)
我使用
$_SERVER["REQUEST_URI"]
来获取当前网址。 然后我通过href将该URL传递给另一个页面。echo "<a href='second.php?url=".$_SERVER["REQUEST_URI"]."'>Click here</a>"; //the url in this case is index.php?tit=most+wanted&id=23&c_id=11&ran=378834GSF844
然后在我的第二页,当我做下面的事情
$mc = $_GET['url']; echo $mc;
我只得到
/index.php?tit=most+wanted
其他三个参数怎么了? 是否有可能摆脱前面的斜线?
I am using
$_SERVER["REQUEST_URI"]
to get the current url. Then I am passing that url to another page via href.echo "<a href='second.php?url=".$_SERVER["REQUEST_URI"]."'>Click here</a>"; //the url in this case is index.php?tit=most+wanted&id=23&c_id=11&ran=378834GSF844
Then on my second page when I do the below
$mc = $_GET['url']; echo $mc;
I only get
/index.php?tit=most+wanted
What happened to other three parameters? is it possible also to get rid of the slash on the front?
原文:https://stackoverflow.com/questions/20366353
更新时间:2024-04-22 11:04
最满意答案
试着扭转它,像这样:
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^/dev/([a-zA-Z0-9_-]+)$ /$1 </IfModule>
Try to reverse it, like this:
<IfModule mod_rewrite.c> RewriteEngine On RewriteRule ^/dev/([a-zA-Z0-9_-]+)$ /$1 </IfModule>
相关问答
更多-
有一个很好的备份;-) 说真的! cd到您的Music文件夹 类型find . -type f -iname '*.mp3' -mindepth 2 -print0 | xargs -0 -I{} mv -n '{}' . find . -type f -iname '*.mp3' -mindepth 2 -print0 | xargs -0 -I{} mv -n '{}' . have a good backup ;-) Seriously! cd to your Music folder type fi ...
-
从我可以收集你的git仓库的根目录只有一个文件夹,ph_dorms,其中有你的项目的其余部分? 这应该可以做到这一点: cd
/PH_Dorms mv ph_dorms/* . rmdir ph_dorms git add --a git commit -m ' ' git push 上面的内容将ph_dorms的内容移动到根目录并安全地删除ph_dorms文件夹。 然后它将您的更改添加到GitHub。 From what I can gather your git repos ... -
试着扭转它,像这样:
RewriteEngine On RewriteRule ^/dev/([a-zA-Z0-9_-]+)$ /$1 Try to reverse it, like this:RewriteEngine On RewriteRule ^/dev/([a-zA-Z0-9_-]+)$ /$1 -
因此,这可以在单个位置块本身中实现 location ~ ^/(?P
\w+)/(app_dev|config)\.php(/|$) { #further rewrite to the /web subfolder with the front controller rewrite ^/(\w+)/(app_dev|config)\.php(/|$) /$1/web/$2.php$is_args$args break; fastcgi_pass $app:9000; fas ... -
对不同的文件夹使用重写(Using Rewrite for different folders)[2022-02-09]
您可以创建每个案例或具有动态 注意:如果一个文件夹存在,你需要添加: RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d 如果您创建每个案例,则必须指定每个子文件夹,如: RewriteRule ^contact/test/([_a-zA-Z0-9]+)/?$ /contact.php?test=$1 [L,QSA] 如果你是动态的,你将不得不在PHP主文件中处理每个页面,然后在该文件中创建一个逻辑来解析正确的信 ... -
htaccess URL重写 - 根到子文件夹(具有相同名称的文件夹)(htaccess URL Rewrite - Root to Subfolder (with folder of the same name))[2022-03-02]
创建/blog/.htaccess如果它尚不存在)并放置此规则: RewriteEngine On RewriteBase /blog/ RewriteRule ^/?$ blog.html [L] # To internally forward /blog/file to /blog/file.html RewriteCond %{DOCUMENT_ROOT}/blog/$1\.html -f [NC] RewriteRule ^(.+?)/?$ $1.html [L] Create /blog/. ... -
os.path.split()创建头部和尾部,因此您需要拆分两次以获取祖父目录,例如: import os for dirpath, _, files in os.walk('pathto/parent'): for f in files: if f.endswith('.tsv'): os.rename(os.path.join(dirpath, f), os.path.join(dirpath, os.path.split(os.path.split(di ...
-
那是因为路径是你现在的位置。 如果您只想打印子目录,则需要执行以下操作: for path, dirs, files in os.walk('data'): for dirname in dirs: print(os.path.join(path, dirname)) That's because path is where you currently are. If you just want to print the subdirectories you'll need to ...
-
这应该做你想要的事情: for /f %x in ("%CD%") do md %~nx_fun 编辑添加:这假设您位于要创建子目录的父目录中。 希望这足以指出你正确的方向。 :-) 编辑2 :通过“父目录”,我指的是特定的父目录(例如,parent1)。 要迭代实际父级中的每个目录(在图中仅标记为Directory),请尝试以下操作: for /d %d in (*) do md %d\%d_fun 给定一个目录结构,如: C:\test C:\test\dir1 C:\test\dir2 ...从 ...
-
如何使用Excel VBA将Outlook子文件夹移动到其他父文件夹(How to move Outlook subfolder to a different parentfolder with Excel VBA)[2022-05-22]
在Excel中,这将从子文件夹“ new ”移动子文件夹“ test ”,使其成为“已处理”的子文件夹。 (需要参考Outlook) Sub moveSubFolderToNewFolder() Dim objOutlook As Outlook.Application Dim objNamespace As Outlook.Namespace Dim objSourceFolder As Outlook.MAPIFolder Dim objDestFolder As Ou ...