本文整理汇总了PHP中MongoCursor::storeFile方法的典型用法代码示例。如果您正苦于以下问题:PHP MongoCursor::storeFile方法的具体用法?PHP MongoCursor::storeFile怎么用?PHP MongoCursor::storeFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MongoCursor
的用法示例。
在下文中一共展示了MongoCursor::storeFile方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testOverwrite
public function testOverwrite()
{
$fh1 = fopen('tests/somefile', 'r');
$fh2 = fopen('mongo.c', 'r');
$this->object->storeFile($fh1, array('_id' => 1));
$this->object->storeFile($fh2, array('_id' => 1));
$file = $this->object->findOne();
$this->assertEquals(129, $file->file['length'], json_encode($file->file));
}
示例2: testMD5
public function testMD5()
{
$mid = $this->object->storeFile("mongo.c");
$gid = $this->object->storeFile("gridfs.c");
$mongo = $this->object->findOne(array("_id" => $mid));
$gridfs = $this->object->findOne(array("_id" => $gid));
$this->assertNotEquals($mongo->file['md5'], $gridfs->file['md5']);
$this->assertEquals($mongo->file['md5'], md5(file_get_contents("mongo.c")));
$this->assertEquals($gridfs->file['md5'], md5(file_get_contents("gridfs.c")));
}
示例3: testEmpty
public function testEmpty() {
$this->object->storeFile('tests/empty');
$file = $this->object->findOne();
$this->assertEquals(0, $file->file['length']);
}