MongoGridFSFile::getBytes
(PECL mongo >=0.9.0)
MongoGridFSFile::getBytes — Returns this file's contents as a string of bytes
Description
public string MongoGridFSFile::getBytes
( void
)
Warning: this will load the file into memory. If the file is bigger than your memory, this will cause problems!
Parameters
This function has no parameters.
Return Values
Returns a string of the bytes in the file.
Examples
Example #1 MongoGridFSFile::getBytes() example
<?php
$images = $db->my_db->getGridFS('images');
$image = $images->findOne('jwage.png');
header('Content-type: image/png;');
echo $image->getBytes();
?>
- PHP Руководство
- Функции по категориям
- Индекс функций
- Справочник функций
- Расширения для работы с базами данных
- Расширения для работы с базами данных отдельных производителей
- MongoDB
- Классы GridFS
- Функция MongoGridfsFile::__construct() - Create a new GridFS file
- Функция MongoGridFSFile::getBytes() - Returns this file's contents as a string of bytes
- Функция MongoGridFSFile::getFilename() - Returns this file's filename
- Функция MongoGridFSFile::getResource() - Returns a resource that can be used to read the stored file
- Функция MongoGridFSFile::getSize() - Returns this file's size
- Функция MongoGridFSFile::write() - Writes this file to the filesystem
Коментарии
404 Not Found