fetchAll(); 我"/>
PHP头条
热点:

请教php如何讲数据库返回的查询数据转化为json数据格式


请问php怎么讲数据库返回的查询数据转化为json数据格式
   在zend 框架里面的
    $res=$db->query("select  name from job_type where tid=$type")->fetchAll();
我把数组打出来是这个东西:


array(2) { [0]=> array(1) { ["name"]=> string(6) "技工" } [1]=> array(1) { ["name"]=> string(6) "普工" } }




    分享到:
------解决方案--------------------
$res=json_encode($res);
echo $res;
exit();

www.phpzy.comtrue/phprm/6887.htmlTechArticle请教php如何讲数据库返回的查询数据转化为json数据格式 请问php怎么讲数据库返回的查询数据转化为json数据格式 在zend框架里面的 $res=$db->query("selectnamefromjob_typewheretid=$type")->fetchAll(); 我...

相关文章

相关频道:

PHP之友评论

今天推荐