解决方案 »

  1.   

    print_r($result);
    能看到什么?
      

  2.   

    $result是一个对象来的,输出有错:
    Catchable fatal error: Object of class Result could not be converted to string in D:\WWW\wsd\trunk\src\server\api\getClients.php on line 44
      

  3.   

    Object of class Result could not be converted to string 对象不能被转换为字符串
    既如此,当然也不能 json 了
    看看你的 Client 类定义
      

  4.   

    编码问题,json_encode()只对utf-8有效,创建数据库表的时候设置好表的编码为utf-8,连接数据库的时候也设置一下编码就行了,类似:
    function connect_host() {
    $host = "127.0.0.1";
    $name_db = "root";
    $password_db ="root";
    $name_tb = "wsd_db";
    $con = mysql_connect($host, $name_db, $password_db);

    if(!$con) {
    echo "connect host failed". mysql_error();
    return;
    }
    mysql_select_db($name_tb, $con);
    mysql_query("SET NAMES UTF8");#设置utf-8编码
    return $con;
    }