本文整理匯總了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;
}