Home > Backend Development > PHP Tutorial > 如何将字符串转码成urlencode的形式

如何将字符串转码成urlencode的形式

WBOY
Release: 2016-06-23 14:18:18
Original
1046 people have browsed it

直接使用urlencode转码出来,结果还是字符串
而不是像这种:%6E1%7A%62%2F%6D%615%5C%76%740
如何英文字符能转成这种


回复讨论(解决方案)

echo $s = preg_replace('/../', '%$0', bin2hex('abc'));//%61%62%63echo urldecode($s); //abc
Copy after login

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template