如何从URL获取波斯/阿拉伯字符,然后显示

发布于 2025-02-02 02:36:34 字数 413 浏览 3 评论 0原文

我已经对此进行了编码:

$url = "https://sitename.com/product-category/کتگوری";
$parsed = parse_url($url);
$path = $parsed['path'];
$path_parts = explode('/', $path);
$desired_output = $path_parts[2]; 
echo $desired_output;

现在返回的结果是: %d8%a2%D9%86

涉及>ککک陨正确地。

因此,我需要在波斯语/阿拉伯字符中正确显示$ desired_output

如何做?

I have coded this:

$url = "https://sitename.com/product-category/کتگوری";
$parsed = parse_url($url);
$path = $parsed['path'];
$path_parts = explode('/', $path);
$desired_output = $path_parts[2]; 
echo $desired_output;

Now the returned result is this: %d8%a2%d9%86

Which is referring to کتگوری but does not show up correctly.

So I need to show the $desired_output correctly in persian/arabic characters.

How to do this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

最冷一天 2025-02-09 02:36:34
echo rawurldecode($desired_output);
echo rawurldecode($desired_output);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文