WP_Filesystem_Direct::copy()
Copies a file.
Метод класса: WP_Filesystem_Direct{}
Хуков нет.
Возвращает
true|false
. True on success, false on failure.
Использование
$WP_Filesystem_Direct = new WP_Filesystem_Direct(); $WP_Filesystem_Direct->copy( $source, $destination, $overwrite, $mode );
- $source(строка) (обязательный)
- Path to the source file.
- $destination(строка) (обязательный)
- Path to the destination file.
- $overwrite(true|false)
- Whether to overwrite the destination file if it exists.
По умолчанию: false - $mode(int|false)
- The permissions as octal number, usually 0644 for files,
0755 for dirs.
По умолчанию: false
Список изменений
С версии 2.5.0 | Введена. |
Код WP_Filesystem_Direct::copy() WP Filesystem Direct::copy WP 6.5.2
public function copy( $source, $destination, $overwrite = false, $mode = false ) { if ( ! $overwrite && $this->exists( $destination ) ) { return false; } $rtval = copy( $source, $destination ); if ( $mode ) { $this->chmod( $destination, $mode ); } return $rtval; }