Home > php教程 > php手册 > body text

关于android与php传递数据,引号显示&quot的问题

WBOY
Release: 2016-06-06 19:58:58
Original
1329 people have browsed it

评论模块中,发送给服务器的单引号,双引号等,存到mysql时,会自动变成#039,quot;这类转义码。 解决方法如下: 1,在存储时,对数据进行转义,使这些需要转义的符号,转义后存入数据库。读取时无需处理。 2.在读取时进行处理 if(content.contains()){ conten

评论模块中,发送给服务器的单引号,双引号等,存到mysql时,会自动变成',"这类转义码。

解决方法如下:

1,在存储时,对数据进行转义,使这些需要转义的符号,转义后存入数据库。读取时无需处理。

2.在读取时进行处理  

if(content.contains("&")){

      content = content.replace("'", "'");
      content = content.replace(""", "\"");
      content = content.replace("<", "<");
content =content.replace(">", ">");
      content =content.replace("&", "&");

}



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 Recommendations
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!