當前位置: 首頁>>代碼示例>>PHP>>正文


PHP MongoDB::getGridFS方法代碼示例

本文整理匯總了PHP中MongoDB::getGridFS方法的典型用法代碼示例。如果您正苦於以下問題:PHP MongoDB::getGridFS方法的具體用法?PHP MongoDB::getGridFS怎麽用?PHP MongoDB::getGridFS使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在MongoDB的用法示例。


在下文中一共展示了MongoDB::getGridFS方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: testGetGridFS

 public function testGetGridFS()
 {
     if (preg_match("/5\\.1\\../", phpversion())) {
         $this->markTestSkipped("No implicit __toString in 5.1");
         return;
     }
     $grid = $this->object->getGridFS();
     $this->assertTrue($grid instanceof MongoGridFS);
     $this->assertTrue($grid instanceof MongoCollection);
     $this->assertEquals((string) $grid, "phpunit.fs.files");
     $this->assertEquals((string) $grid->chunks, "phpunit.fs.chunks");
     $grid = $this->object->getGridFS("foo");
     $this->assertEquals((string) $grid, "phpunit.foo.files");
     $this->assertEquals((string) $grid->chunks, "phpunit.foo.chunks");
     $grid = $this->object->getGridFS("foo", "bar");
     $this->assertEquals((string) $grid, "phpunit.foo.files");
     $this->assertEquals((string) $grid->chunks, "phpunit.foo.chunks");
 }
開發者ID:redmeadowman,項目名稱:mongo-php-driver,代碼行數:18,代碼來源:MongoDBTest.php

示例2: gridFS

 public function gridFS($arg1 = NULL, $arg2 = NULL)
 {
     $this->_connected or $this->connect();
     if (!isset($arg1)) {
         $arg1 = isset($this->_config['gridFS']['arg1']) ? $this->_config['gridFS']['arg1'] : 'fs';
     }
     if (!isset($arg2) && isset($this->_config['gridFS']['arg2'])) {
         $arg2 = $this->_config['gridFS']['arg2'];
     }
     return $this->_db->getGridFS($arg1, $arg2);
 }
開發者ID:execrot,項目名稱:mongostar,代碼行數:11,代碼來源:Connection.php

示例3: saveFile

	/**
	 * Saves a file to MongoDB
	 *
	 * @param string $filePath
	 * @param array $oldReference
	 * @return mixed The id of the stored file
	 */
	public function saveFile($filePath, $oldReference = null)
	{
		$id = null;
		if (file_exists($filePath)) {
			if (!empty($oldReference)) {
				$this->db->getGridFS()->remove(array('_id' => $oldReference), true); //remove existing file
			}
			$id = $this->db->getGridFS()->storeFile($filePath);
		} else {
			throw new \InvalidArgumentException("The file $filePath does not exist");
		}
		return $id;
	}
開發者ID:rickyrobinett,項目名稱:morph,代碼行數:20,代碼來源:Storage.php

示例4: doGetGridFS

 /**
  * Return a new GridFS instance.
  *
  * @see Database::getGridFS()
  * @param string $prefix
  * @return GridFS
  */
 protected function doGetGridFS($prefix)
 {
     $mongoGridFS = $this->mongoDB->getGridFS($prefix);
     return new GridFS($this, $mongoGridFS, $this->eventManager);
 }
開發者ID:alcaeus,項目名稱:mongodb,代碼行數:12,代碼來源:Database.php


注:本文中的MongoDB::getGridFS方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。