后台转义字符问题

WBOY
Release: 2016-06-23 13:58:43
Original
773 people have browsed it

我用php输出ajax到html页面
其中ajax中的data属性如下
data:\'val=\'+\'\"\'+data+\'\"\',    相当于(data: val=" data ")
但是data本来就是一个字符串吧,不知道为什么要加双引号

到我到后台处理的时候$_POST['val'];发现前后多了转义字符"   无论我用什么方法都不能替换掉,解释掉"  请问怎么破
,如果可以,我最希望是改ajax中的参数写的方式,不知道是不是我写得太复杂


回复讨论(解决方案)

data: {val : data}

接收页
echo $_POST['val']; 

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!