本文整理汇总了PHP中MongoCursor::storeBytes方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoCursor::storeBytes方法的具体用法?PHP MongoCursor::storeBytes怎么用?PHP MongoCursor::storeBytes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoCursor
的用法示例。
在下文中一共展示了MongoCursor::storeBytes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testStoreBytes
public function testStoreBytes() {
$x = chr(0);
$y = chr(255);
$z = chr(127);
$w = chr(128);
$bytes = "${x}4g7$y$z$w$x";
$this->object->storeBytes($bytes, array('myopt' => new MongoBinData($bytes)));
$obj = $this->object->findOne();
$this->assertNotNull($obj, "this can be caused by an old db version or if objcheck is on");
$b = $obj->getBytes();
$this->assertEquals($b, $obj->file['myopt']->bin);
$this->assertEquals(8, strlen($b));
$this->assertEquals(0, ord(substr($b, 0)));
$this->assertEquals(52, ord(substr($b, 1)));
$this->assertEquals(103, ord(substr($b, 2)));
$this->assertEquals(55, ord(substr($b, 3)));
$this->assertEquals(255, ord(substr($b, 4)));
$this->assertEquals(127, ord(substr($b, 5)));
$this->assertEquals(128, ord(substr($b, 6)));
$this->assertEquals(0, ord(substr($b, 7)));
}