Home  >  Article  >  php教程  >  关于android与php传递数据,引号显示&quot的问题

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

WBOY
WBOYOriginal
2016-06-06 19:58:581330browse

评论模块中,发送给服务器的单引号,双引号等,存到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("&", "&");

}



Statement:
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