Php/docs/sqlite3.backup
来自菜鸟教程
SQLite3::backup
(PHP 7 >= 7.4.0)
SQLite3::backup — Backup one database to another database
说明
public SQLite3::backup
( SQLite3 $destination_db
[, string $source_dbname
= "main"
[, string $destination_dbname
= "main"
]] ) : bool
SQLite3::backup() copies the contents of one database into another, overwriting the contents of the destination database. It is useful either for creating backups of databases or for copying in-memory databases to or from persistent files.
参数
destination_db
- A database connection opened with SQLite3::open().
source_dbname
- The database name is
"main"
for the main database,"temp"
for the temporary database, or the name specified after theAS
keyword in anATTACH
statement for an attached database. destination_dbname
- Analogous to
source_dbname
but for thedestination_db
.
返回值
成功时返回 true
, 或者在失败时返回 false
。
范例
Example #1 Backup an existing database
<?php// $conn is a connection to an already opened sqlite3 database$backup = new SQLite3('backup.sqlite');$conn->backup($backup);?>