当前位置: 首页>>代码示例>>PHP>>正文


PHP Mongo::__toString方法代码示例

本文整理汇总了PHP中Mongo::__toString方法的典型用法代码示例。如果您正苦于以下问题:PHP Mongo::__toString方法的具体用法?PHP Mongo::__toString怎么用?PHP Mongo::__toString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mongo的用法示例。


在下文中一共展示了Mongo::__toString方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: __toString

 /** @proxy */
 public function __toString()
 {
     $this->initialize();
     return $this->mongo->__toString();
 }
开发者ID:ud223,项目名称:yj,代码行数:6,代码来源:Connection.php

示例2: test__toString2

    public function test__toString2() {
        $m = new Mongo("mongodb://localhost:27018,localhost:27017,localhost:27019");
        $this->assertEquals("[localhost:27018],localhost:27017,[localhost:27019]", $m->__toString());
        $m->foo->bar->findOne();
        $this->assertEquals("[localhost:27018],localhost:27017,[localhost:27019]", $m->__toString());
        $this->assertEquals(51, strlen($m->__toString()));

        // realloc
        $m = new Mongo("mongodb://localhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhosta:27018,localhost:27017");
        $m->phpunit->c->findOne();
        $this->assertEquals("[localhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhosta:27018],localhost:27017", $m->__toString());
        $this->assertEquals(274, strlen($m->__toString()));
    }
开发者ID:neurodrone,项目名称:mongo-php-driver,代码行数:13,代码来源:MongoTest.php

示例3: fopen

<?php

$handle = fopen("php://stdin", "r");
$line = fgets($handle);
$host = trim($line);
$m = new Mongo($host, array("replicaSet" => true));
// stupid freakin server list
$strSet = explode(",", $m->__toString());
$set = array();
foreach ($strSet as $server) {
    $s = trim($server, "[]");
    $set[$s] = true;
}
foreach ($set as $k => $v) {
    echo "{$k}\n";
}
$db = $m->replset;
$x = 0;
while ($x < 5) {
    try {
        $z = $db->test->findOne();
        $x = $z['a'];
        echo "{$x}\n";
    } catch (MongoException $e) {
        echo "E\n";
    }
}
开发者ID:frankff,项目名称:mongo-snippets,代码行数:27,代码来源:test.php

示例4: testMongoToString

 /**
  * Mongo::toString() was destroying Mongo::server
  */
 public function testMongoToString()
 {
     $m = new Mongo();
     $str1 = $m->__toString();
     $str2 = $m->__toString();
     $this->assertEquals("localhost:27017", $str2);
     $this->assertEquals($str1, $str2);
 }
开发者ID:redmeadowman,项目名称:mongo-php-driver,代码行数:11,代码来源:RegressionTest1.php

示例5: test__toString2

 public function test__toString2()
 {
     $m = new Mongo("mongodb://localhost:27018,localhost:27017,localhost:27019");
     $this->assertEquals("localhost:27017,[localhost:27018],[localhost:27019]", $m->__toString());
     $this->assertEquals(51, strlen($m->__toString()));
     // realloc
     $m = new Mongo("mongodb://localhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhosta:27018,localhost:27017");
     $this->assertEquals("localhost:27017,[localhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhostalocalhosta:27018]", $m->__toString());
     $this->assertEquals(274, strlen($m->__toString()));
 }
开发者ID:redmeadowman,项目名称:mongo-php-driver,代码行数:10,代码来源:MongoTest.php


注:本文中的Mongo::__toString方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。