Home > Backend Development > PHP Tutorial > 关于utf页面 字符串url编码转换为gbk问题

关于utf页面 字符串url编码转换为gbk问题

WBOY
Release: 2016-06-20 12:46:09
Original
939 people have browsed it

比如我一个字符串为"天天",如何生成gbk  "%cc%ec%cc%ec" ,这是在这个页面生成的http://tool.chinaz.com/Tools/URLEncode.aspx
我页面为utf8,如何使用urlencode 生成GBK的编码呢?


回复讨论(解决方案)

echo urlencode(iconv('utf-8', 'gbk', $s));

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