定義
パラメーター
$filename: string- 名前を変更するファイルの
filename。 $newFilename: string- 新しい
filename値。
エラーと例外
MongoDB\GridFS\Exception\FileNotFoundException 選択基準に一致するファイルが見つからなかった場合は、。
MongoDB$Driver\Exception\RuntimeException は、拡張レベルの他のエラーの場合(例:)。
例
$bucket = (new MongoDB\Client)->test->selectGridFSBucket();
$stream = fopen('php://temp', 'w+b');fwrite($stream, "foobar");rewind($stream);
$bucket->uploadFromStream('a', $stream);
$bucket->renameByName('a', 'b');
var_dump(stream_get_contents($bucket->openDownloadStreamByName('b')));出力は次のようになります。
string(6) "foobar"