服务器请求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> 

相关问答

更多

将所有文件从子文件夹递归移动到父文件夹(Moving all files recursively from subfolders to parent)

有一个很好的备份;-) 说真的! 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 ty...

GIT:将父/子文件夹的所有内容移动到父/(GIT: Moving all content of a parent/subfolder to parent/)

从我可以收集你的git仓库的根目录只有一个文件夹,ph_dorms,其中有你的项目的其余部分? 这应该可以做到这一点: cd <path>/PH_Dorms mv ph_dorms/* . rmdir ph_dorms git add --a git commit -m '<message>' git push 上面的内容将ph_dorms的内容移动到根目录并安全地删除ph_dorms文件夹。 然后它将您的更改添加到GitHub。 From what I can gather your git ...

从子文件夹重写到父文件夹(Rewrite from subfolder to parent folder)

试着扭转它,像这样: <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>

Nginx重写到root下的子文件夹(Nginx rewrite to subfolder under root)

因此,这可以在单个位置块本身中实现 location ~ ^/(?P<app>\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; ...

对不同的文件夹使用重写(Using Rewrite for different folders)

您可以创建每个案例或具有动态 注意:如果一个文件夹存在,你需要添加: 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))

创建/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 /b...

重命名具有一级子文件夹名称的文件(rename files with a subfolder name one level up)

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.spl...

打印没有父文件夹的子文件夹?(Print subfolder without parent folder?)

那是因为路径是你现在的位置。 如果您只想打印子目录,则需要执行以下操作: 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 nee...

创建与父级同名的子文件夹(Create subfolder with same name as parent)

这应该做你想要的事情: 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)

在Excel中,这将从子文件夹“ new ”移动子文件夹“ test ”,使其成为“已处理”的子文件夹。 (需要参考Outlook) Sub moveSubFolderToNewFolder() Dim objOutlook As Outlook.Application Dim objNamespace As Outlook.Namespace Dim objSourceFolder As Outlook.MAPIFolder Dim objDestFolder ...

相关文章

更多

最近遇到一个Ext.Ajax.request的奇怪问题

最近在学Extjs,照着视频做了一个提交数据并且添加store的demo,却遇到一个奇怪的问题:添加第 ...

自己封装的一个Solr Data Import Request Handler Scheduler

经过将近一天的努力,终于搞定了Solr的Data Import Request HandlerSche ...

Cannot expose request attribute 'website' because of an existing model object of the same name 的解决方案

在使用springmvc+freemarker,有可能你会遇到以下异常(如:资源找不到重定向到404的 ...

服务器端通过http请求区分是mobile还是pc

近来在开发一个基于手机上网的项目。遇到的第一件事情就是,该项目需要同时支持手机和PC。详细的说:当pc ...

httpclient 带参数 get 请求

httpclient带参数get请求和默认get请求的主要区别是要初始化HttpGet的方式 默认的g ...

全文搜索服务器solr之客户端 - solrj二次开发

Solrj已经是很强大的solr客户端了。它本身就包装了httpCliet,以完全对象的方式对solr ...

使用grep和正则来分析Web服务器日志

使用grep和正则来分析Web服务器日志 | 彭琪谈编程 使用grep和正 ...

HttpClient PUT请求示例

本教程演示如何使用Apache HttpClient 4.5发出Http PUT请求。 HTTP PU ...

HTTP服务器篇-高性能WEB开发

因tomcat处理静态资源的速度比较慢,所以首先想到的就是把所有静态资源(JS,CSS,image,s ...

整合Solr到Tomcat服务器,并配置IK分词

好久没有接触新东西了,最新开始熟悉solr,实例展示单机环境solr整合. 整合方案一 1.下载Tom ...

最新问答

更多

python的访问器方法有哪些

使用方法: class A(object): def foo(self,x): #类实例方法 print "executing foo(%s,%s)"%(self,x) @classmethod def class_foo(cls,x): #类方法 print "executing class_foo(%s,%s)"%(cls,x) @staticmethod def static_foo(x): #静态方法 print "executing static_foo(%s)"%x调用方法: a =

使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)

我认为你必须将两个TableGetway传递给UserTable构造。 你必须改变Module.php看看: public function getServiceConfig() { return array( 'factories' => array( 'User\Model\UserTable' => function($sm) { $userTableGateway = $sm->get('UserTable

透明度错误IE11(Transparency bug IE11)

这是一个渲染错误,由使用透明度触发,使用bootstrap用于在聚焦控件周围放置蓝色光环的box-shadow属性。 可以通过添加以下类覆盖来解决它。 .form-control:hover { -webkit-box-shadow: 0px 0px 5px 0px rgba(0,0,255,1); -moz-box-shadow: 0px 0px 5px 0px rgba(0,0,255,1); box-shadow: 0px 0px 4px 0px rgba(0,0,255,1)

linux的基本操作命令。。。

ls 显示目录 mkdir 建立目录 cd 进入目录

响应navi重叠h1和nav上的h1链接不起作用(Responsive navi overlaps h1 and navi links on h1 isn't working)

将z-index设置为.main-nav这将解决您的重叠问题 .main-nav { position:relative; z-index:9; } set z-index to .main-nav This will fix your overlaping issue .main-nav { position:relative; z-index:9; }

在C中读取文件:“r”和“a +”标志的不同行为(Reading a File in C: different behavior for “r” and “a+” flags)

这是因为模式规范"a"打开一个文件以便追加,文件指针在末尾。 如果您尝试从此处读取,则由于文件指针位于EOF,因此没有数据。 您应该打开"r+"进行阅读和写作。 如果在写入之前读取整个文件,则在写入更多数据时,文件指针将正确定位以追加。 如果这还不够,请探索ftell()和fseek()函数。 That is because the mode spec "a" opens a file for appending, with the file pointer at the end. If you

NFC提供什么样的带宽?(What Kind of Bandwidth does NFC Provide?)

支持空中接口的数据速率是一回事。 在消除协议开销,等待eeprom写入以及所有需要时间的其他内容之后,您看到的数据速率是完全不同的故事。 长话短说,从标签读取或进行对等传输时的实际数据速率峰值约为2.5千字节/秒。 取决于具体的标签或对等技术,它可能比这慢很多。 The supported data-rates of the air-interface are one thing. The data-rate that you see after removing protocol overhe

元素上的盒子阴影行为(box-shadow behaviour on elements)

它看起来像只在Windows上的Chrome的错误。 我在Google Canary (Chrome 63)中也进行了测试,问题依然存在,所以有可能它不会很快修复。 这个问题是由overflow: auto引起的overflow: auto ,在你的情况下,它可以很容易地通过删除或设置为可见(默认)来解决。 但是 ,将鼠标悬停在右侧(顶部和底部)时,会出现滚动条。 一个解决方案可以设置overflow: hidden的身体,所以预期的结果是所需的。 我想指出,这不是一个很好的解决方案,但我建议暂

Laravel检查是否存在记录(Laravel Checking If a Record Exists)

这取决于您是否要以后与用户合作,或仅检查是否存在。 如果要使用用户对象(如果存在): $user = User::where('email', '=', Input::get('email'))->first(); if ($user === null) { // user doesn't exist } 如果你只想检查 if (User::where('email', '=', Input::get('email'))->count() > 0) { // user found

设置base64图像的大小javascript - angularjs(set size of a base64 image javascript - angularjs)

$scope.getData= function () { var reader = new FileReader(); reader.onload = $('input[type=file]')[0].files; var img = new Image(); img.src =(reader.onload[0].result); img.onload = function() { if(this.width > 640