本文整理汇总了PHP中filesystem::copy方法的典型用法代码示例。如果您正苦于以下问题:PHP filesystem::copy方法的具体用法?PHP filesystem::copy怎么用?PHP filesystem::copy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类filesystem
的用法示例。
在下文中一共展示了filesystem::copy方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: basename
$fs->move($file, $path . '/' . basename($file));
}
}
}
while ($file = smartstrip(array_shift($_SESSION['copy_files']))) {
if ($file != $path . '/' . basename($file)) {
if (!$fs->has_read_permission($GO_SECURITY->user_id, $file)) {
$popup_feedback .= access_denied_box($file);
break;
} elseif (!$fs->has_write_permission($GO_SECURITY->user_id, $path)) {
$popup_feedback .= access_denied_box($path);
break;
} elseif ($fs->chroot_file_exists($path . '/' . basename($file))) {
if ($overwrite_destination_path == $path . '/' . basename($file) || $overwrite_all == 'true') {
if ($overwrite == "true") {
$fs->copy($file, $path . '/' . basename($file));
}
} else {
array_unshift($_SESSION['copy_files'], $file);
$overwrite_source_path = $file;
$overwrite_destination_path = $path . '/' . basename($file);
$task = 'overwrite';
break;
}
} else {
$fs->copy($file, $path . '/' . basename($file));
}
}
}
while ($folder = smartstrip(array_shift($_SESSION['cut_folders']))) {
if ($folder != $path . '/' . basename($folder)) {
示例2: array
switch ($task) {
case 'upload':
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
$task = 'list';
if (isset($_FILES['file'])) {
$_SESSION['cut_files'] = array();
$_SESSION['cut_folders'] = array();
$_SESSION['copy_folders'] = array();
$_SESSION['copy_files'] = array();
for ($i = 0; $i < count($_FILES['file']['tmp_name']); $i++) {
if (is_uploaded_file($_FILES['file']['tmp_name'][$i])) {
$extension = get_extension($_FILES['file']['name'][$i]);
if (!$filetypes->get_type($extension)) {
$filetypes->add_type($extension, $_FILES['file']['type'][$i]);
}
if ($fs->copy($_FILES['file']['tmp_name'][$i], $GO_CONFIG->tmpdir . '/' . $_FILES['file']['name'][$i])) {
$_SESSION['copy_files'][] = $GO_CONFIG->tmpdir . '/' . $_FILES['file']['name'][$i];
}
}
}
while ($file = smartstrip(array_shift($_SESSION['copy_files']))) {
$new_path = $path . '/' . basename($file);
if (!$write_permission) {
$popup_feedback .= access_denied_box($path);
break;
} elseif (file_exists($new_path)) {
if ($overwrite_destination_path == $new_path && $overwrite_all != 'true') {
if ($overwrite == "true") {
$fs->copy($file, $new_path);
}
} else {