PHP 中的 URL 解码 [英] URL Decoding in PHP

查看:46
本文介绍了PHP 中的 URL 解码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 PHP 的 urldecode 函数解码此 URL 字符串:

I am trying to decode this URL string using PHP's urldecode function:

urldecode("Ant%C3%B4nio+Carlos+Jobim");

这应该是输出...

'Antônio Carlos Jobim'

...而是输出这个

'Antônio Carlos Jobim'

我已经在 基于 JS 的在线解码器 中测试了该字符串并取得了巨大成功,但是好像不能在服务器端做这个操作.有什么想法吗?

I've tested the string in a JS-based online decoder with great success, but can't seem to do this operation server side. Any ideas?

推荐答案

您的字符串 UTF-8 编码.这将起作用:

Your string is also UTF-8 encoded. This will work:

echo utf8_decode(urldecode("Ant%C3%B4nio+Carlos+Jobim"));

输出:安东尼奥·卡洛斯·乔宾".

Output: "Antônio Carlos Jobim".

这篇关于PHP 中的 URL 解码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆