锟斤拷取一锟斤拷锟接硷拷

锟斤拷锟角匡拷锟斤拷锟矫诧拷询锟斤拷锟斤拷锟接硷拷锟斤拷锟叫伙拷枚锟斤拷锟侥碉拷锟斤拷 锟斤拷锟界:锟斤拷要锟斤拷锟� "i" > 50 锟斤拷锟侥碉拷锟斤拷锟斤拷锟斤拷锟斤拷要锟斤拷

<?php
$connection 
= new MongoClient();
$collection $connection->database->collectionName;

$query = array( "i" => array( '$gt' => 50 ) ); //note the single quotes around '$gt'
$cursor $collection->find$query );

while ( 
$cursor->hasNext() )
{
    
var_dump$cursor->getNext() );
}
?>

锟斤拷锟斤拷锟斤拷示 "i" > 50 锟斤拷锟侥碉拷锟斤拷也锟斤拷锟皆伙拷锟揭伙拷锟斤拷锟轿э拷诘锟斤拷牡锟斤拷锟斤拷锟斤拷锟� 20 < i <= 30锟斤拷

<?php
$connection = new MongoClient();
$collection = $connection->database->collectionName;

$query = array( 'i' => array( '$gt' => 20, "\$lte" => 30 ) );
$cursor = $collection->find( $query );

while ( $cursor->hasNext() )
{
    var_dump( $cursor->getNext() );
}
?>

要注锟斤拷锟斤拷元锟街凤拷始锟秸讹拷锟斤拷要转锟藉,锟斤拷锟竭匡拷锟斤拷锟矫碉拷锟斤拷锟脚达拷锟芥。锟斤拷锟斤拷 PHP 锟斤拷锟斤拷锟斤拷锟斤拷锟斤拷啥锟接︼拷谋锟斤拷锟� $gt锟斤拷