2017-05-09 46 views

回答

0

嘗試這種情況:只需更改dbNamecollectionName

 <?php 
     $connection = new MongoClient(sprintf('mongodb://%s:%d/%s', '127.0.0.1', '27017', 'dbName'));  
     $db = $connection->selectDB('dbName'); 
     $table = $db->selectCollection('collectionName'); 
     $cursor = $table->find( 
          array(      
            'msisdn_start_range' => array('$lt' => 919967288367), 
            'msisdn_end_range' => array('$gt' => 919967288367)           
           ) 
          ); 
     $cursor = iterator_to_array($cursor); 
     echo "<pre>"; 
     print_r($cursor);