js传递参数给php有乱码
我在做整合搜索功能时候,前端是js提交参数给php出现乱码,在javascript代码中用 span style=color:#ff0000;encodeURIComponent()/span函数处理中文字符串再传递就没有乱码 br / a target=_blank href=http://
我在做整合搜索功能时候,前端是js提交参数给php出现乱码,在javascript代码中用
encodeURIComponent()函数处理中文字符串再传递就没有乱码
http://www.iiwnet.com/javascript/844.html
http://www.iiwnet.com/javascript/844.html
<script type="text/javascript"> string = encodeURIComponent(string); location.href = index.php?keyword='+string; </script>
2. [代码]PHP代码 跳至 [1] [2] [全屏预览]
<?php $keyword = (isset($_GET['keyword'])) ? $_GET['keyword'] : ''; ?>
- 上一篇:根据数据长度对数组排序
- 下一篇:360通用防护 过滤用户输入的数据,实现防注
精彩图集
精彩文章