本文整理汇总了PHP中file::rename方法的典型用法代码示例。如果您正苦于以下问题:PHP file::rename方法的具体用法?PHP file::rename怎么用?PHP file::rename使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类file
的用法示例。
在下文中一共展示了file::rename方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: write
/**
* Writes a line in the log file
*
* @param string $line
*/
public function write($line)
{
file::append($this->filepath, date($this->date_format) . ' - ' . $line . "\n");
// If the max size is exceeded
if (file::getSize($this->filepath) >= $this->max_size) {
file::delete($this->filepath . '.' . $this->nb_old_logs);
for ($i = $this->nb_old_logs; $i >= 1; $i--) {
if (file::exists($this->filepath . ($i == 1 ? '' : '.' . ($i - 1)))) {
file::rename($this->filepath . ($i == 1 ? '' : '.' . ($i - 1)), $this->filepath . '.' . $i);
}
}
}
}
示例2: actionRename
public function actionRename($file = '')
{
$file = empty($file) ? zotop::get('file') : $file;
$file = trim(url::decode($file), '/');
$filepath = site::template($file);
if (form::isPostBack()) {
$newname = zotop::post('newname');
if (file::rename($filepath, $newname)) {
msg::success('重命名成功');
}
msg::error('重命名失败');
}
$page = new dialog();
$page->title = zotop::t('模板编辑器');
$page->set('file', $file);
$page->set('filepath', $filepath);
$page->display();
}
示例3: rename
function rename()
{
$path = $this->input->post('path');
$tree = $this->input->post('folder');
$check = strripos($path, '/');
$ds = '/';
if ($check === false) {
$check = strripos($path, '\\');
$ds = '\\';
}
if ($check === false) {
echo lang('media_folder_found');
exit;
}
$folders = explode($ds, $path);
if ($folders > 1) {
$src = '';
$n = count($folders) - 1;
for ($i = 0; $i < $n; $i++) {
if ($i == 0) {
$src = $folders[$i];
} else {
$src .= $ds . $folders[$i];
}
}
$src .= $ds . $tree;
}
$this->load->library('file');
$file = new file();
echo $file->rename($this->root . $path, $this->root . $src);
exit;
}