PHP 手册
后退 |  | 前进

# dbmopen

(PHP 3, PHP 4, PECL)

dbmopen -- Opens a DBM database

## Description

resource dbmopen ( string filename, string flags )

The first argument is the full-path filename of the DBM file to be opened and the second is the file open mode which is one of "r", "n", "c" or "w" for read-only, new (implies read-write, and most likely will truncate an already-existing database of the same name), create (implies read-write, and will not truncate an already-existing database of the same name) and read-write respectively.

Returns an identifier to be passed to the other DBM functions on success, or `FALSE` on failure.

If NDBM support is used, NDBM will actually create `filename.dir` and `filename.pag` files. GDBM only uses one file, as does the internal flat-file support, and Berkeley DB creates a `filename.db` file. Note that PHP does its own file locking in addition to any file locking that may be done by the DBM library itself. PHP does not delete the `.lck` files it creates. It uses these files simply as fixed inodes on which to do the file locking. For more information on DBM files, see your Unix man pages, or obtain GNU's GDBM.

> 注: 当安全模式被激活时，PHP 将检查被操作的文件或者目录是否与正在执行的脚本有相同的 UID（所有者）。

后退 | 起点 | 前进
dbmnextkey | 上一级 | dbmreplace