特殊字符被编码。不知道如何还原它?

问题描述 投票:0回答:1

我正在使用函数get_query_var()来检索我的url路径。

我的网址看起来像:/categories/500-Beställning

现在要检索这个我使用:

$url = get_query_var('title2');

如果我var_dump($url);我得到:string(29) "500-Best%C3%A4llning"

现在字母ä被编码。我已经尝试了无效的utf8_decode函数来解码它。但我不太确定编码的内容以及如何正确解码它。谢谢!

php wordpress decode
1个回答
2
投票

要解码URL编码数据,请使用urldecode

<?php
  $string = "500-Best%C3%A4llning";
  print urldecode($string);
?>
© www.soinside.com 2019 - 2024. All rights reserved.