我想将符号"&“和"=”添加到选项的值中,但输出总是返回%26和%3d。我怎么才能解码出值呢?
<option class="low-high" value="<?php $encoded='price%26product_list_dir%3Dasc';
echo rawurldecode($encoded);?>">输出返回price%26product_list_dir=asc,但我想要price&product_list_dir=asc
发布于 2019-01-24 06:59:34
我添加了这个脚本,现在它可以工作了。感谢大家的帮助
<script type="text/javascript">
jQuery(function($) {
$('select').on('change', function() {
var url = $(this).val();
if (url) {
window.location = url;
}
return false;
});
});
</script>发布于 2019-01-22 05:53:31
您只需将字符串的一部分替换为正确的符号
$str = "price%26product_list_dir%3Dasc";
$keywords = array("%26", "%3D");
$replacement = array("&", "=");
$res = str_replace($keywords, $replacement, $str);https://stackoverflow.com/questions/54296080
复制相似问题