Phar::copy() - Phar类
Phar::copy()
(PHP 5 >= 5.3.0, PHP 7, PECL phar >= 2.0.0)
Copy a file internal to the phar archive to another new file within the phar
说明
publicPhar::copy(string $oldfile,string $newfile): boolNote:此方法需要将php.ini中的phar.readonly设为0以适合Phar对象.否则,将抛出PharException.
Copy a file internal to the phar archive to another new file within the phar. This is an object-oriented alternative to using copy() with the phar stream wrapper.
参数
$oldfile$newfile返回值
returns TRUE
on success, but it is safer to encase method call in a try/catch block and assume success if no exception is thrown.
错误/异常
throws UnexpectedValueException if the source file does not exist, the destination file already exists, write access is disabled, opening either file fails, reading the source file fails, or a PharException if writing the changes to the phar fails.
范例
A Phar::copy() example
This example shows using Phar::copy() and the equivalent stream wrapper performance of the same thing. The primary difference between the two approaches is error handling. All Phar methods throw exceptions, whereas the stream wrapper uses trigger_error().
鹏仔微信 15129739599 鹏仔QQ344225443 鹏仔前端 pjxi.com 共享博客 sharedbk.com
图片声明:本站部分配图来自网络。本站只作为美观性配图使用,无任何非法侵犯第三方意图,一切解释权归图片著作权方,本站不承担任何责任。如有恶意碰瓷者,必当奉陪到底严惩不贷!