百分比编码网址两次 [英] Percent-encode URL Twice
本文介绍了百分比编码网址两次的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
已向我提供了一些指令,以对URL进行两次编码。我知道如何一次对URL进行一次编码,但是如何两次进行编码?
I have been given some instructions to percent encode a URL twice. I know how to percent encode a URL once but how do you do it twice?
当然,一旦编码一次,再次编码就一样。
Surly when it is encoded once, it will be the same when encoded again.
我错过了什么吗?
指令或算法会很棒!
推荐答案
它赢了因为您对用于编码的%
进行了编码,所以不一样。
It won't be the same since you encode the %
used for encoding.
$url = 'http://www.youtube.com/watch?v=35_0IN36rUI'
echo $url;
echo urlencode($url);
echo urlencode(urlencode($url));
将会给出:
http://www.youtube.com/watch?v=35_0IN36rUI
http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D35_0IN36rUI
http%253A%252F%252Fwww.youtube.com%252Fwatch%253Fv%253D35_0IN36rUI
这篇关于百分比编码网址两次的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文