删除echo json_encode()上的引号; [英] remove quote on echo json_encode();
本文介绍了删除echo json_encode()上的引号;的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
$result = mysql_query("SELECT * FROM $tableName WHERE id=1");
$array = mysql_fetch_array($result);
$help_name = $array['name'];
$req = $array['req'];
//fetch result
echo json_encode($help_name);
问题是我得到带双引号的结果,如何删除双引号
Problem is I'm getting the result with double quotes, how to remove the double quotes
推荐答案
尝试在php中修整
<?php
$name = "Aman";
$str = json_encode($name);
echo trim($str, '"'); // output : Aman
?>
这篇关于删除echo json_encode()上的引号;的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文