本文整理汇总了PHP中COM::CopyFile方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::CopyFile方法的具体用法?PHP COM::CopyFile怎么用?PHP COM::CopyFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COM
的用法示例。
在下文中一共展示了COM::CopyFile方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: lxfile_cp_rec
function lxfile_cp_rec($dirsource, $dirdest)
{
dprint("<b> I am here </b> ");
$obj = new COM("Scripting.FilesystemObject");
$username = "__system__";
$dirdest = expand_real_root($dirdest);
$dirsource = expand_real_root($dirsource);
if (lfile_exists($dirdest) && is_dir($dirdest)) {
$dirdest = $dirdest . "/" . basename($dirsource);
}
if (is_dir($dirsource)) {
log_filesys("copyFolder {$dirsource} {$dirdest}");
$obj->CopyFolder($dirsource, $dirdest);
} else {
log_filesys("copyFile {$dirsource} {$dirdest}");
$obj->CopyFile($dirsource, $dirdest);
}
}
示例2: copyArt
/**
* Copy the album art file to local directory with ASCII only characters so PHP can work with it properly
* COM object must be used for unicode filenames
*
* @param string $file Absolute path of art file
* @return bool True/false success/failure
*/
function copyArt(string $file) : bool
{
$destination = getcwd() . "\\art\\" . basename($file);
$return = false;
echo "Copying album art...";
try {
$com = new COM("Scripting.FileSystemObject", null, CP_UTF8);
$com->CopyFile($file, $destination);
$return = true;
} catch (Exception $e) {
echo "Unable to copy art '{$file}' to '{$destination}': " . $e->getMessage() . "\n";
}
$com = null;
return $return;
}