我怎样才能在PHP中使用javascript decodeURI? [英] how can I javascript decodeURI in PHP?

查看:130
本文介绍了我怎样才能在PHP中使用javascript decodeURI?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个javascript,它将一些特定信息发送到PHP api。在发送之前它执行encodeURI。如何在PHP中解码它?我知道urldecode / urlencode与javascript编码/ decodeURI不同,那么我可以使用什么?

I have a javascript which sends some specific information to a PHP api . Before to send it performs encodeURI . How can I "decode" it in PHP ? I understand that urldecode/urlencode is different that javascript encode/decodeURI so what can I use ?

推荐答案

除非你编码了它多次(例如,通过显式调用encode方法并将值插入到随后提交的表单字段中),您不需要执行任何操作 - 在解析请求时,它会透明地转换回其原始形式。

Unless you've encoded it multiple times (e.g. by explicitly calling the encode method AND inserting the value into a form field which is then submitted) you don't need to do anything - it is transparently converted back to its original form when the request is parsed.

这篇关于我怎样才能在PHP中使用javascript decodeURI?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆