如何使用PHP对中文单词进行编码?

How to encode the Chinese word using PHP?

我需要使用php对中文单词进行编码,例如

%E7%8F%AD%E7%BA%B3-bangna

班纳-bangna

请尝试给我一个好的解决方案..

谢谢。

使用urldecode

$str = "%E7%8F%AD%E7%BA%B3-bangna";
echo urldecode($str);

Output

班纳-bangna

Demo