php 的 json 格式 数据 怎么去除 双引号?
展开全部
可以使用PHP addslashes() 函数转义一下
addslashes() 函数在指定的预定义字符前添加反斜杠。
这些预定义字符是:
单引号 (')
双引号 (")
反斜杠 (\)
NULL
例如:
<?php
$str = "Who's John Adams?";
echo $str . " This is not safe in a database query.<br />";
echo addslashes($str) . " This is safe in a database query.";
?>
输出:
Who's John Adams? This is not safe in a database query.
Who\'s John Adams? This is safe in a database query.
addslashes() 函数在指定的预定义字符前添加反斜杠。
这些预定义字符是:
单引号 (')
双引号 (")
反斜杠 (\)
NULL
例如:
<?php
$str = "Who's John Adams?";
echo $str . " This is not safe in a database query.<br />";
echo addslashes($str) . " This is safe in a database query.";
?>
输出:
Who's John Adams? This is not safe in a database query.
Who\'s John Adams? This is safe in a database query.
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询