php javascript url编码 [英] php javascript url encoding

查看:64
本文介绍了php javascript url编码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个HTML文字。我使用urlencode函数在php中对其进行了编码。
我想在javascript中解码该文本。
当我在javascript中使用unescape函数时,它会替换所有特殊字符,但sapce将替换为'+'。我怎样才能正确地将空间替换为空间本身?

I have a html text. I had encoded it in php using urlencode function. I want to decode that text in the javascript. when i use unescape function in javascript it replaces all the special characters back but sapce is replaced by '+'. how can i do it correctly so that space is replaced as space itself???

推荐答案

尝试使用rawurlencode - urlencode做一些由于历史原因,情况有所不同。

Try using rawurlencode instead - urlencode does some things differently for "historical" reasons.

参见 http://us.php.net/manual/en/function.urlencode.php 了解更多信息。

这篇关于php javascript url编码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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