PHP中的URL编码和解码

时间:2017-05-19 06:56:35

标签: php url

这是我昨天在此问过的上一个问题的后续跟进:Slashes in GET request (to be used with PHP back end)

我有一个包含2个GET参数的链接,每当我访问该网站时,我想在PHP中使用它。该链接中包含spacesslashes

使用前一个问题中提供的惊人答案,我能够获取参数并通过get方法检索它们,如下所示:

https://randomness.com?path=%2Fvar%2Fimages%2Fsub%20images%2&name=image%2001.jpg

$path = $_GET['path'];
$name = $_GET['name'];

然后我按以下方式合并上述内容:

$filePath = "$path" . "$name";

然后echoying $filepath,给了我:/var/images/sub images/&name=image01.jpg 然后在我的方法show($filepath);

中使用它

不幸的是,这不起作用。 但是,如果我使用以下内容:

show('/var/images/sub images/&name=image01.jpg') 方法很好。

要进行更多调查,每当我使用strcmp进行比较时,我会得到一个字符串比另一个字符串大,即使echoyin在屏幕上显示相同内容。

strcmp($file_name, '/var/images/sub images/&name=image01.jpg'); 

我错过了什么?

0 个答案:

没有答案