本文整理汇总了PHP中file_del函数的典型用法代码示例。如果您正苦于以下问题:PHP file_del函数的具体用法?PHP file_del怎么用?PHP file_del使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了file_del函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: save
function save()
{
include load('include.lang');
if (!$this->is_allow()) {
return $this->_($L['upload_not_allow']);
}
$this->set_savepath($this->savepath);
$this->set_savename($this->savename);
if (file_copy($this->file, DT_ROOT . '/' . $this->saveto)) {
if (!@getimagesize(DT_ROOT . '/' . $this->saveto)) {
file_del(DT_ROOT . '/' . $this->saveto);
return $this->_($L['upload_bad']);
}
if ($this->maxsize > 0 && filesize(DT_ROOT . '/' . $this->saveto) > $this->maxsize) {
file_del(DT_ROOT . '/' . $this->saveto);
return $this->_($L['upload_size_limit'] . ' (' . intval($this->maxsize / 1024) . 'Kb)');
}
$this->image = 1;
return true;
} else {
return $this->_($L['upload_failed']);
}
}
开发者ID:hcd2008,项目名称:destoon,代码行数:23,代码来源:remote.class.php
示例2: cache_clear
function cache_clear($str, $type = '', $dir = '')
{
$dir = $dir ? DT_CACHE . '/' . $dir . '/' : DT_CACHE . '/';
$files = glob($dir . '*');
if (is_array($files)) {
if ($type == 'dir') {
foreach ($files as $file) {
if (is_dir($file)) {
dir_delete($file);
} else {
if (file_ext($file) == $str) {
file_del($file);
}
}
}
} else {
foreach ($files as $file) {
if (!is_dir($file) && strpos(basename($file), $str) !== false) {
file_del($file);
}
}
}
}
}
开发者ID:oneoneplus,项目名称:webshell,代码行数:24,代码来源:global.func.php
示例3: defined
<?php
defined('IN_DESTOON') or exit('Access Denied');
if (!$MOD['sitemaps']) {
file_del(DT_ROOT . '/sitemaps.xml');
return false;
}
$today = timetodate($DT_TIME, 3);
$mods = explode(',', $MOD['sitemaps_module']);
$nums = intval($MOD['sitemaps_items'] / count($mods));
$data = '<?xml version="1.0" encoding="UTF-8"?>';
$data .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';
$data .= '<url>';
$data .= '<loc>' . DT_PATH . '</loc>';
$data .= '<lastmod>' . $today . '</lastmod>';
$data .= '<changefreq>always</changefreq>';
$data .= '<priority>1.0</priority>';
$data .= '<data><display></display></data>';
$data .= '</url>';
$item = '';
foreach ($mods as $mid) {
if (isset($MODULE[$mid]) && !$MODULE[$mid]['islink'] && !$MODULE[$mid]['domain']) {
if ($mid == 4 && $CFG['com_domain']) {
continue;
}
$url = $MODULE[$mid]['linkurl'];
$data .= '<url>';
$data .= '<loc>' . $url . '</loc>';
$data .= '<lastmod>' . $today . '</lastmod>';
$data .= '<changefreq>hourly</changefreq>';
$data .= '<priority>0.9</priority>';
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:sitemaps.htm.php
示例4: substr
$ext = substr($word, -3);
$file = '';
$type = 'text';
if ($str == 'http' && in_array($ext, array('jpg', 'amr', 'mp3', 'mp4'))) {
if (strpos($word, DT_PATH) === 0) {
$file = str_replace(DT_PATH, DT_ROOT . '/', $word);
} else {
if ($DT['remote_url'] && strpos($word, $DT['remote_url']) === 0) {
$file = DT_ROOT . '/file/temp/' . date('YmdHis', $DT_TIME) . mt_rand(10, 99) . $_userid . '.' . $ext;
file_copy($word, $file);
}
}
if (strpos($file, '/file/') !== false && strpos($file, '..') === false && is_file($file)) {
$arr = $wx->http_upload($file);
if ($arr[0]) {
file_del($file);
$word = $arr[0];
//Media_ID
$type = $arr[1];
} else {
dalert('上传失败 - ' . $arr[1], '', 'window.parent.chat_show();');
}
}
}
$arr = $wx->send($openid, $type, $word);
if ($arr['errcode'] != 0) {
if ($arr['errcode'] == 45015) {
dalert('回复时间超过限制[须48小时内回复]', '', 'window.parent.chat_hide(1);');
}
dalert('发送失败 - ' . $arr['errmsg'] . '(errcode:' . $arr['errcode'] . ')', '', 'window.parent.chat_show();');
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:weixin.inc.php
示例5: ob_start
if ($typeid == 4) {
if (in_array(strtolower(file_ext($flash_src)), array('jpg', 'jpeg', 'png', 'gif', 'bmp'))) {
$typeid = 3;
$image_src = $flash_src;
}
}
}
}
ob_start();
include template($template, $module);
$data = ob_get_contents();
ob_clean();
file_put($filename, '<!--' . $totime . '-->' . $data);
if ($typeid > 1) {
$data = 'document.write(\'' . dwrite($data) . '\');';
file_put(DT_ROOT . '/file/script/A' . $p['pid'] . '.js', $data);
}
} else {
file_del($filename);
if ($typeid > 1) {
if ($p['code']) {
file_put(DT_ROOT . '/file/script/A' . $p['pid'] . '.js', $p['code']);
} else {
file_del(DT_ROOT . '/file/script/A' . $p['pid'] . '.js');
}
}
}
}
}
}
return true;
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:ad.htm.php
示例6: tpl
$fields[$k]['name'] = $edit ? $_fields[$k]['name'] : '';
$fields[$k]['value'] = $edit ? $_fields[$k]['value'] : '';
}
include tpl('data_config');
}
break;
case 'download':
if ($name) {
file_down(DT_ROOT . '/file/data/' . $name . '.php');
}
msg();
break;
case 'delete':
if ($name) {
file_del(DT_ROOT . '/file/data/' . $name . '.php');
file_del(DT_ROOT . '/file/data/' . $name . '.inc.php');
}
dmsg('删除成功', '?file=' . $file);
break;
case 'view':
$data = array();
@(include DT_ROOT . '/file/data/' . $name . '.php');
$data = dstripslashes($data);
extract($data);
if ($database == 'mysql') {
if ($db_host && $db_user && $db_name) {
$sc = new db_mysql();
$sc->connect($db_host, $db_user, $db_pass, $db_name, $CFG['db_expires'], $CFG['db_charset'], $CFG['pconnect']);
} else {
$sc =& $db;
}
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:data.inc.php
示例7: tohtml
$moduleid = 1;
$module = 'destoon';
tohtml('index');
$msgs = array('保存系统配置.................成功', '数据库连接....................成功', '创建数据库....................成功', '创建数据表....................成功', '插入初始数据.................成功', '设置管理员....................成功', '安装系统模型.................成功', '更新系统缓存.................成功', '更新模块缓存.................成功', '更新模板缓存.................成功', '生成网站密钥.................成功', '生成网站首页.................成功', '锁定安装程序.................就绪');
$percent = '80%';
include IN_ROOT . '/step_' . $step . '.tpl.php';
break;
case '6':
//安装成功
$percent = '100%';
include IN_ROOT . '/step_' . $step . '.tpl.php';
$DT_TIME = time();
file_put(DT_CACHE . '/install.lock', $DT_TIME);
$index = file_get(DT_ROOT . '/index.html');
if (strpos($index, 'install/') !== false) {
file_del(DT_ROOT . '/index.html');
}
file_put(DT_ROOT . '/install/index.php', '<script type="text/javascript">window.location="../?success="+Math.random();</script>');
break;
case 'db_test':
if (!mysql_connect($tdb_host, $tdb_user, $tdb_pass)) {
exit('<script>alert("无法连接到数据库服务器,请检查配置");</script>');
}
if (!mysql_select_db($tdb_name)) {
if (!mysql_query("CREATE DATABASE {$tdb_name}")) {
exit('<script>alert("指定的数据库不存在\\n\\n系统尝试创建失败,请通过其他方式建立数据库");</script>');
}
mysql_select_db($tdb_name);
}
$tables = array();
$query = mysql_list_tables($tdb_name);
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:index.php
示例8: dftp
$ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
if ($ftp->connected) {
$exp = explode("file/upload/", $saveto);
$remote = $exp[1];
if ($ftp->dftp_put($do->saveto, $remote)) {
$saveto = $DT['remote_url'] . $remote;
$DT['ftp_save'] or file_del(DT_ROOT . '/' . $do->saveto);
if (strpos($do->saveto, '.thumb.') !== false) {
$local = str_replace('.thumb.' . $do->ext, '', $do->saveto);
$remote = str_replace('.thumb.' . $do->ext, '', $exp[1]);
$ftp->dftp_put($local, $remote);
$DT['ftp_save'] or file_del(DT_ROOT . '/' . $local);
$local = str_replace('.thumb.' . $do->ext, '.middle.' . $do->ext, $do->saveto);
$remote = str_replace('.thumb.' . $do->ext, '.middle.' . $do->ext, $exp[1]);
$ftp->dftp_put($local, $remote);
$DT['ftp_save'] or file_del(DT_ROOT . '/' . $local);
}
}
}
}
$fid = isset($fid) ? $fid : '';
if (isset($old) && $old && in_array($from, array('thumb', 'photo'))) {
delete_upload($old, $_userid);
}
$_saveto = $swfupload ? str_replace('.thumb.' . $do->ext, '', $saveto) : $saveto;
$_SESSION['uploads'][] = $_saveto;
if ($DT['uploadlog']) {
$db->query("INSERT INTO {$upload_table} (item,fileurl,filesize,fileext,upfrom,width,height,moduleid,username,ip,addtime,itemid) VALUES ('" . md5($saveto) . "','{$saveto}','{$do->file_size}','{$do->ext}','{$from}','{$img_w}','{$img_h}','{$moduleid}','{$_username}','{$DT_IP}','{$do->uptime}','{$itemid}')");
}
if ($MG['uploadcredit'] > 0) {
require DT_ROOT . '/include/module.func.php';
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:upload.php
示例9: array
$tmp = array();
foreach (explode('&', $par) as $v) {
$t = explode('=', $v);
$tmp[$t[0]] = $t[1];
}
$tmp['pic'] = '@' . $pic;
$par = $tmp;
}
}
$cur = curl_init('https://graph.qq.com/t/' . ($pic ? 'add_pic_t ' : 'add_t'));
curl_setopt($cur, CURLOPT_POST, 1);
curl_setopt($cur, CURLOPT_POSTFIELDS, $par);
curl_setopt($cur, CURLOPT_FOLLOWLOCATION, 1);
curl_setopt($cur, CURLOPT_HEADER, 0);
curl_setopt($cur, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($cur, CURLOPT_RETURNTRANSFER, 1);
if ($headers) {
curl_setopt($cur, CURLOPT_HTTPHEADER, $headers);
}
$rec = curl_exec($cur);
curl_close($cur);
if ($pic && strpos($pic, 'file/temp') !== false) {
file_del($pic);
}
#log_write($rec, 'qq', 1);
if (strpos($rec, '<msg>ok</msg>') === false) {
//fail
} else {
//success
}
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:post.php
示例10: is_array
$itemids = is_array($itemid) ? implode(',', $itemid) : $itemid;
$db->query("DELETE FROM {$DT_PRE}banip WHERE itemid IN ({$itemids})");
dmsg('删除成功', '?file=' . $file);
break;
case 'clear':
$db->query("DELETE FROM {$DT_PRE}banip WHERE totime>0 and totime<{$DT_TIME}");
dmsg('清空成功', '?file=' . $file);
break;
case 'unban':
$ip or msg('IP不能为空');
if (is_array($ip)) {
foreach ($ip as $v) {
file_del(DT_CACHE . '/ban/' . $v . '.php');
}
} else {
file_del(DT_CACHE . '/ban/' . $ip . '.php');
}
dmsg('删除成功', '?file=' . $file . '&action=ban');
break;
case 'ban':
$ips = glob(DT_CACHE . '/ban/*.php');
$lists = array();
if ($ips) {
foreach ($ips as $k => $v) {
$lists[$k]['ip'] = basename($v, '.php');
$lists[$k]['addtime'] = timetodate(filemtime($v), 5);
}
}
include tpl('banip_ban');
break;
default:
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:banip.inc.php
示例11: getimagesize
$w2 = $s2[0];
$h2 = $s2[1];
$s3 = getimagesize($img[3]);
$w3 = $s3[0];
$h3 = $s3[1];
if ($s1 && $s2 && $s3 && $w1 == 128 && $h1 == 128 && $w2 == 48 && $h2 == 48 && $w3 == 20 && $h3 == 20) {
$md5 = md5($user['username']);
$dir = DT_ROOT . '/file/avatar/' . substr($md5, 0, 2) . '/' . substr($md5, 2, 2) . '/_' . $user['username'];
$img[4] = $dir . '.jpg';
$img[5] = $dir . 'x48.jpg';
$img[6] = $dir . 'x20.jpg';
file_put($img[4], base64_decode($pic1));
file_put($img[5], base64_decode($pic2));
file_put($img[6], base64_decode($pic3));
if ($DT['ftp_remote'] && $DT['remote_url']) {
require DT_ROOT . '/include/ftp.class.php';
$ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
if ($ftp->connected) {
foreach ($img as $i) {
$t = explode("/file/", $i);
$ftp->dftp_put('file/' . $t[1], $t[1]);
}
}
}
echo '{"status":1}';
} else {
file_del($img[1]);
file_del($img[2]);
file_del($img[3]);
exit('{"status":3}');
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:upload.php
示例12: dmsg
}
dmsg('备份文件恢复失败');
break;
case 'download':
if (!$fileid) {
msg('文件名不能为空');
}
$file_ext = $bakid ? '.' . $bakid . '.bak' : '.css';
file_down($skin_root . $fileid . $file_ext);
break;
case 'delete':
if (!$fileid) {
msg('文件名不能为空');
}
$file_ext = $bakid ? '.' . $bakid . '.bak' : '.css';
file_del($skin_root . $fileid . $file_ext);
dmsg('文件删除成功', $this_forward);
break;
default:
$files = $skins = $baks = array();
$files = glob($skin_root . '*.*');
if (!$files) {
msg('风格文件不存在,请先创建', "?file={$file}&action=add");
}
foreach ($files as $k => $v) {
$filename = str_replace($skin_root, '', $v);
if (preg_match("/^[0-9a-z_-]+\\.css\$/", $filename)) {
$fileid = str_replace('.css', '', $filename);
$skins[$fileid]['fileid'] = $fileid;
$skins[$fileid]['filename'] = $filename;
$skins[$fileid]['filesize'] = round(filesize($v) / 1024, 2);
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:31,代码来源:skin.inc.php
示例13: delete_upload
function delete_upload($file, $userid)
{
global $CFG, $DT, $DT_TIME, $ftp, $db;
if (!defined('DT_ADMIN') && (!$userid || $userid != match_userid($file))) {
return false;
}
$fileurl = $file;
if (strpos($file, 'file/upload') === false) {
//Remote
if ($DT['ftp_remote'] && $DT['remote_url']) {
if (strpos($file, $DT['remote_url']) !== false) {
if (!is_object($ftp)) {
require_once DT_ROOT . '/include/ftp.class.php';
$ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
}
$file = str_replace($DT['remote_url'], '', $file);
$ftp->dftp_delete($file);
if (strpos($file, '.thumb.') !== false) {
$ext = file_ext($file);
$F = str_replace('.thumb.' . $ext, '', $file);
$ftp->dftp_delete($F);
$F = str_replace('.thumb.' . $ext, '.middle.' . $ext, $file);
$ftp->dftp_delete($F);
}
}
}
} else {
$exp = explode("file/upload/", $file);
$file = DT_ROOT . '/file/upload/' . $exp[1];
if (is_file($file) && strpos($exp[1], '..') === false) {
file_del($file);
if (strpos($file, '.thumb.') !== false) {
$ext = file_ext($file);
file_del(str_replace('.thumb.' . $ext, '', $file));
file_del(str_replace('.thumb.' . $ext, '.middle.' . $ext, $file));
}
}
}
if ($DT['uploadlog']) {
$db->query("DELETE FROM {$db->pre}upload_" . $userid % 10 . " WHERE item='" . md5($fileurl) . "'");
}
}
开发者ID:hcd2008,项目名称:destoon,代码行数:42,代码来源:post.func.php
示例14: Copyright
<?php
/*
[Destoon B2B System] Copyright (c) 2008-2013 Destoon.COM
This is NOT a freeware, use is subject to license.txt
*/
defined('IN_DESTOON') or exit('Access Denied');
$menus = array(array('木马扫描', '?file=scan'), array('文件校验', '?file=' . $file));
$sys = array('admin', 'api', 'include', 'javascript', 'lang', 'module', 'template', 'wap');
$fbs = array('file', 'cache');
switch ($action) {
case 'delete':
preg_match("/^[0-9]{4}[\\-]{1}[0-9]{2}[\\-]{1}[0-9]{2}[\\s]{1}[0-9]{2}[\\.]{1}[0-9]{2}\$/", $mirror) or msg('请选择镜像文件');
file_del(DT_ROOT . '/file/md5/' . $mirror . '.php');
dmsg('删除成功', '?file=' . $file);
break;
case 'add':
$filedir or $filedir = $sys;
$fileext or $fileext = 'php|js|htm';
$files = array();
foreach (glob(DT_ROOT . '/*.*') as $f) {
if (preg_match("/(config\\.inc\\.php|version\\.inc\\.php)\$/i", $f)) {
continue;
}
if (preg_match("/\\.({$fileext})\$/i", $f)) {
$files[] = $f;
}
}
foreach ($filedir as $d) {
$files = array_merge($files, get_file(DT_ROOT . '/' . $d, $fileext));
}
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:md5.inc.php
示例15: exit
case 'template_name':
$fileid or exit('0');
$name or exit('0');
$name = convert($name, 'UTF-8', DT_CHARSET);
template_name($fileid, $name);
exit('1');
break;
case 'download':
$fileid or msg();
$file_ext = $bakid ? '.' . $bakid . '.bak' : '.htm';
file_down($template_root . '/' . $fileid . $file_ext);
break;
case 'delete':
$fileid or msg();
$file_ext = $bakid ? '.' . $bakid . '.bak' : '.htm';
file_del($template_root . '/' . $fileid . $file_ext);
if (!$bakid) {
template_name();
}
dmsg('删除成功', $this_forward);
break;
case 'cache':
cache_clear('php', 'dir', 'tpl');
dmsg('更新成功', $this_forward);
break;
default:
$dirs = $files = $templates = $baks = array();
if (substr($template_root, -1) != '/') {
$template_root .= '/';
}
$files = glob($template_root . '*');
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:template.inc.php
示例16: delete
function delete($aid)
{
if (is_array($aid)) {
foreach ($aid as $v) {
$this->delete($v);
}
} else {
$this->aid = $aid;
$a = $this->get_one();
$filename = ad_name($a);
file_del(DT_CACHE . '/htm/' . $filename);
$userid = get_user($a['username']);
if ($a['image_src']) {
delete_upload($a['image_src'], $userid);
}
if ($a['flash_src']) {
delete_upload($a['flash_src'], $userid);
}
$this->db->query("DELETE FROM {$this->table} WHERE aid={$aid}");
$this->db->query("UPDATE {$this->table_place} SET ads=ads-1 WHERE pid={$a['pid']}");
}
}
开发者ID:hcd2008,项目名称:destoon,代码行数:22,代码来源:ad.class.php
示例17: dheader
case 'update':
$t = $avatar ? 1 : 0;
$db->query("UPDATE {$DT_PRE}member SET avatar={$t} WHERE userid={$_userid}");
dheader('avatar.php?itemid=' . $DT_TIME);
break;
case 'delete':
if ($avatar) {
$img = array();
$img[1] = useravatar($_userid, 'large', 0, 2);
$img[2] = useravatar($_userid, '', 0, 2);
$img[3] = useravatar($_userid, 'small', 0, 2);
$img[4] = useravatar($_username, 'large', 1, 2);
$img[5] = useravatar($_username, '', 1, 2);
$img[6] = useravatar($_username, 'small', 1, 2);
foreach ($img as $i) {
file_del($i);
}
if ($DT['ftp_remote'] && $DT['remote_url']) {
require DT_ROOT . '/include/ftp.class.php';
$ftp = new dftp($DT['ftp_host'], $DT['ftp_user'], $DT['ftp_pass'], $DT['ftp_port'], $DT['ftp_path'], $DT['ftp_pasv'], $DT['ftp_ssl']);
if ($ftp->connected) {
foreach ($img as $i) {
$t = explode("/file/", $i);
$ftp->dftp_delete($t[1]);
}
}
}
}
$db->query("UPDATE {$DT_PRE}member SET avatar=0 WHERE userid={$_userid}");
dmsg($L['avatar_delete'], 'avatar.php?itemid=' . $DT_TIME);
break;
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:avatar.inc.php
示例18: dir_delete
dir_delete($dir);
msg('成功添加<strong> ' . $i . ' </strong>张图片', '?moduleid=' . $moduleid . '&action=item&itemid=' . $itemid);
break;
case 'zip':
$itemid or msg();
$_FILES['uploadfile']['size'] or msg('请选择zip文件');
require DT_ROOT . '/include/upload.class.php';
$name = date('YmdHis') . mt_rand(10, 99) . $_userid;
$upload = new upload($_FILES, 'file/temp/', $name . '.zip', 'zip');
$upload->adduserid = false;
if ($upload->save()) {
dir_create(DT_ROOT . '/file/temp/' . $name);
require DT_ROOT . '/admin/unzip.class.php';
$zip = new unzip();
$zip->extract_zip(DT_ROOT . '/file/temp/' . $name . '.zip', DT_ROOT . '/file/temp/' . $name);
file_del(DT_ROOT . '/file/temp/' . $name . '.zip');
if (glob(DT_ROOT . '/file/temp/' . $name . '/*.*')) {
msg('上传并解压缩成功,正在读取..', '?moduleid=' . $moduleid . '&action=dir&name=' . $name . '&itemid=' . $itemid);
} else {
msg('解压缩失败,请检查目录权限');
}
} else {
msg($upload->errmsg);
}
break;
default:
$lists = $do->get_list('status=3' . $condition, $dorder[$order]);
$menuid = 1;
include tpl('index', $module);
break;
}
开发者ID:hcd2008,项目名称:destoon,代码行数:31,代码来源:index.inc.php
示例19: cache_clear_sql
function cache_clear_sql($dir, $all = false)
{
global $DT_TIME;
if ($dir) {
$globs = glob(DT_CACHE . '/sql/' . $dir . '/*.php');
if ($globs) {
foreach ($globs as $v) {
if ($all) {
file_del($v);
} else {
$exptime = intval(substr(file_get($v), 8, 18));
if ($exptime && $DT_TIME > $exptime) {
file_del($v);
}
}
}
}
} else {
cache_clear('php', 'dir', 'sql');
}
}
开发者ID:hiproz,项目名称:zhaotaoci.cc,代码行数:21,代码来源:cache.func.php
示例20: _upload
/**
* function _upload 文件上传
* $width 最大宽度
*/
private function _upload($width = 400)
{
// 更改公共配置文件
$this->upload->upload_path = $this->upload_path;
// 路径
$this->upload->encrypt_name = 1;
// 是否重命名
$this->upload->xss_clean = TRUE;
// 是否做xss过滤
// 初始化$file_name
$file_name = array();
// 通过遍历判断是否有附件上传
foreach ($_FILES as $k => $v) {
// 若有附件上传
if ($v['error'] == 0) {
// 图片类型
if (strpos($k, 'p') === 0) {
$this->upload->allowed_types = array('gif', 'jpg', 'jpeg', 'png');
$this->upload->max_size = 2000;
// 若上传成功
if ($this->upload->do_upload($k)) {
// 记录上传成功的文件名
$file_name[$k] = $this->upload->file_name;
// 若需要压缩
if ($this->upload->image_width > $width) {
$height = $this->upload->image_height * $width / $this->upload->image_width;
$this->_resize($this->upload, $width, $height);
}
} else {
// 1、删除之前上传成功的文件
if (!empty($file_name)) {
file_del($file_name);
}
// 2、提示错误
jump($this->upload->display_errors('', ''));
exit;
}
} else {
$this->upload->allowed_types = array('txt', 'doc', 'docx', 'xls', 'xlsx', 'hlp', 'chm', 'rar', 'zip', 'pdf', '7z');
$this->upload->max_size = 5000;
// 若上传成功
if ($this->upload->do_upload($k)) {
$file_name[$k] = $this->upload->file_name;
} else {
// 1、删除之前上传成功的文件
if (!empty($file_name)) {
file_del($file_name);
}
// 2、提示错误
jump($this->upload->display_errors('', ''));
exit;
}
}
}
}
return $file_name;
}
开发者ID:faydanube,项目名称:xine,代码行数:61,代码来源:back.php
注:本文中的file_del函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论