如何在url中显示符号“&”和“=”?

How to display symbols "&" and "=" in url?

我想在选项的值中添加符号“&”和“=”, 但输出总是 return %26 和 %3d。我如何解码比值?

<option class="low-high" value="<?php $encoded='price%26product_list_dir%3Dasc';
echo rawurldecode($encoded);?>">

输出 return price%26product_list_dir=asc 但我想要 价格&product_list_dir=asc

您可以将字符串的一部分替换为正确的符号

$str = "price%26product_list_dir%3Dasc";
$keywords = array("%26", "%3D");
$replacement = array("&", "=");

$res = str_replace($keywords, $replacement, $str);

我添加了这个脚本,现在可以运行了。谢谢大家的帮助

<script type="text/javascript">
jQuery(function($) {
$('select').on('change', function() {
    var url = $(this).val();
    if (url) {
        window.location = url;
    }
    return false;
 });
});  
</script>