如图,操作没有反应,出现这些东西是什么原因。

解决方案 »

  1.   


    // 连接mongodb  
    function conn($dbhost, $dbname, $dbuser, $dbpasswd){  
        $server = 'mongodb://'.$dbuser.':'.$dbpasswd.'@'.$dbhost.'/'.$dbname;  
        try{  
            $conn = new MongoClient($server);  
            $db = $conn->selectDB($dbname);  
        } catch (MongoException $e){  
            throw new ErrorException('Unable to connect to db server. Error:' . $e->getMessage(), 31);  
        }  
        return $db;  
    }// 查询
    function query($dbconn, $tablename, $limit=10){   
        $coll = $dbconn->selectCollection($tablename);  
        $cursor = $coll->find();  
        $cursor = $cursor->limit($limit);  
          
        $result = array();  
        foreach($cursor as $v){  
            $result[] = $v;  
        }    
      
        return $result;  
    }  $db = conn('192.168.0.73','student','root','12345678'); 
    $result = query($db, 'stu');  
    print_r($result); 试试
      

  2.   

    楼主你的这个是php7操作mongo吗