日期:2014-05-17  浏览次数:20471 次

请问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();