<pre name="code" class="html">一个perl URLencode URLdecode的方法
这是url的uri_escape和uri_unescape,不是针对html的
#引入模块
use URI::Escape;
#urlencode
$encoded = uri_escape("10% is enough\n");
#urldecode
$decoded = uri_unescape($encoded);
jrhmpt01:/root/wx# cat s3.pl
use URI::Escape;
$encoded=uri_escape('@crypt_597aeefd_10918236aa7c541a78a1b25880eeb1cb');
print "\$encoded is $encoded\n";
jrhmpt01:/root/wx# perl s3.pl
$encoded is %40crypt_597aeefd_10918236aa7c541a78a1b25880eeb1cb
perl URLencode URLdecode的方法
最新推荐文章于 2017-11-14 10:00:26 发布
这篇博客介绍了如何在Perl中使用URI::Escape模块进行URL编码和解码。示例代码展示了uri_escape()函数用于编码字符串,如'@crypt_597aeefd_10918236aa7c541a78a1b25880eeb1cb',编码后为'%40crypt_597aeefd_10918236aa7c541a78a1b25880eeb1cb',而uri_unescape()函数则用于解码编码后的字符串。
摘要由CSDN通过智能技术生成