首页
友情链接
统计分析
4K壁纸
Search
1
让浏览器不显示 https 页面中 http 请求警报 http-equiv=”Content-Security-Policy” content=”upgrade-insecure-requests”
356 阅读
2
#1031 – TABLE STORAGE ENGINE FOR ” DOESN’T HAVE THIS OPTION解决方法
340 阅读
3
微信个人商户号养号建议
231 阅读
4
解决移动端position:fixed随软键盘移动的问题
165 阅读
5
Mysql和Redis的本质区别
150 阅读
PHP
Mysql
乱七八糟
常用笔记
Linux
Reids
Search
标签搜索
php
千卡云支付
Linux
千卡云
千卡易支付
redis
Nginx
shell
Mysql
JS
支付宝
CentOS
Apache
phpstorm
快捷键
微信支付
字符
layer
Command
base64
蓝科迪梦
累计撰写
51
篇文章
累计收到
1
条评论
首页
栏目
PHP
Mysql
乱七八糟
常用笔记
Linux
Reids
页面
友情链接
统计分析
4K壁纸
搜索到
1
篇与
的结果
2022-09-25
js前端和php后端对url编解码处理方式不一致的问题
问题:php的解码方式是urldecode,前端的编码方式有escape,encodeURI,encodeURIComponent这三种,escape出来的url,php可以正常解析出来,但是escape不支持ES6,其他两种方式php不能解析正确 解决方法一,根据情况转: URI部分用encodeURI,参数部分用encodeURIComponent,这样才是相对完美的编码方式。 比如`https://example.com/?next=abc...`,得到的结果分别是: encodeURI(`https://example.com/?next=abc...`): "https://example.com/?next=abc.com/def&encoding=utf-8" encodeURIComponent(`https://example.com/?next=abc...`): "https%3A%2F%2Fexample.com%2F%3Fnext%3Dabc.com%2Fdef%26encoding%3Dutf-8" encodeURI(https://example.com/?next=${encodeURIComponent('abc.com/def')}&encoding=${encodeURIComponent('utf-8')}): "https://example.com/?next=abc.com%252Fdef&encoding=utf-8" 解决方法二,base64: json_encode()用eval()还原 base64_decode()用base64_encode()还原 解决方法三,最简单的方法,前后端都不使用转义!
2022年09月25日
68 阅读
0 评论
0 点赞