本文整理汇总了PHP中delDirAndFile函数的典型用法代码示例。如果您正苦于以下问题:PHP delDirAndFile函数的具体用法?PHP delDirAndFile怎么用?PHP delDirAndFile使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了delDirAndFile函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: appUninstall
public function appUninstall()
{
/*
* 更新数据库
* **/
$uninstallSql = sprintf("%s/apps/%s/data/sqls/uninstall.sql", ROOT_PATH, $this->appConfig["alias"]);
if (is_file($uninstallSql)) {
$rs = importSQL($uninstallSql);
// if(true !== $rs) {
// $this->error = $rs[0];
// return false;
// }
}
/*
* 删除APP目录
* **/
delDirAndFile($this->appPath);
rmdir($this->appPath);
if ($this->workflows) {
$this->appDeleteWorkflow($this->workflows);
}
if ($this->authNodes) {
$model = D("AuthRule");
$model->where(array("category" => $this->appConfig["alias"]))->delete();
}
if (is_dir($this->appPath)) {
//$this->error("uninstall failed when remove the app dir");
}
return true;
/*
* 其他扩展文件
* @todo
* **/
}
示例2: cache_clean
/**
* 清理缓存,待完善
*/
public function cache_clean()
{
echo "<span style='color: red;'>缓存清理中……</span><br/>";
$path = RUNTIME_PATH . "Cache/";
echo delDirAndFile($path);
echo "<br/><span style='color: red;'>缓存清理完毕。</span>";
}
示例3: index
public function index()
{
$caches = array("HomeCache" => array("name" => "网站前台缓存文件", "path" => ROOT_PATH . C("DEFAULT_GROUP") . "/Runtime/"), "AdminCache" => array("name" => "网站后台缓存文件", "path" => ROOT_PATH . "Admin/Runtime/"));
foreach ($caches as $val) {
if (isset($val['path'])) {
delDirAndFile($val['path']);
}
}
$this->success('缓存清理成功!', __MODULE__ . '/Main/index');
}
示例4: clear
public function clear()
{
if (IS_POST) {
$PATHs = $_REQUEST['delids'];
$arrPath = str2arr($PATHs, ',');
foreach ($arrPath as $path) {
//var_dump(delDirAndFile($path));
delDirAndFile($path);
}
$this->ajaxReturn(array("status" => 200, "message" => "缓存文件已清除"));
}
}
示例5: delDirAndFile
function delDirAndFile($dirName)
{
if (is_dir($dirName)) {
$handle = @opendir("{$dirName}");
while ($item = @readdir($handle)) {
if ($item != "." && $item != "..") {
delDirAndFile("{$dirName}/{$item}");
}
}
@closedir($handle);
@rmdir($dirName);
} else {
@unlink($dirName);
}
}
示例6: delFileUnderDir
function delFileUnderDir($dirName)
{
if ($handle = opendir("{$dirName}")) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir("{$dirName}/{$item}")) {
delDirAndFile("{$dirName}/{$item}");
} else {
unlink("{$dirName}/{$item}");
}
}
}
closedir($handle);
//rmdir($dirName);
}
}
示例7: _initialize
/**
+----------------------------------------------------------
* 初始化
* 如果 继承本类的类自身也需要初始化那么需要在使用本继承类的类里使用parent::_initialize();
+----------------------------------------------------------
*/
public function _initialize()
{
header("Content-Type:text/html; charset=utf-8");
header('Content-Type:application/json; charset=utf-8');
$systemConfig = (include WEB_ROOT . 'Common/systemConfig.php');
if (empty($systemConfig['TOKEN']['admin_marked'])) {
$systemConfig['TOKEN']['admin_marked'] = "QQ群:102577846";
$systemConfig['TOKEN']['admin_timeout'] = 3600;
$systemConfig['TOKEN']['member_marked'] = "http://blog.51edm.org";
$systemConfig['TOKEN']['member_timeout'] = 3600;
F("systemConfig", $systemConfig, WEB_ROOT . "Common/");
if (is_dir(WEB_ROOT . "install/")) {
delDirAndFile(WEB_ROOT . "install/", TRUE);
}
}
$this->loginMarked = md5($systemConfig['TOKEN']['admin_marked']);
$this->checkLogin();
// 用户权限检查
if (C('USER_AUTH_ON') && !in_array(MODULE_NAME, explode(',', C('NOT_AUTH_MODULE')))) {
import('ORG.Util.RBAC');
if (!RBAC::AccessDecision()) {
//检查认证识别号
if (!$_SESSION[C('USER_AUTH_KEY')]) {
//跳转到认证网关
redirect(C('USER_AUTH_GATEWAY'));
// redirect(PHP_FILE . C('USER_AUTH_GATEWAY'));
}
// 没有权限 抛出错误
if (C('RBAC_ERROR_PAGE')) {
// 定义权限错误页面
redirect(C('RBAC_ERROR_PAGE'));
} else {
if (C('GUEST_AUTH_ON')) {
$this->assign('jumpUrl', C('USER_AUTH_GATEWAY'));
}
// 提示错误信息
// echo L('_VALID_ACCESS_');
$this->error(L('_VALID_ACCESS_'));
}
}
}
$this->assign("menu", $this->show_menu());
$this->assign("sub_menu", $this->show_sub_menu());
$this->assign("my_info", $_SESSION['my_info']);
$this->assign("site", $systemConfig);
$this->getQRCode();
}
示例8: updatenow
public function updatenow(){
include('Update.class.php');
$version = './WQLData/version.php';
$ver = include($version);
$ver = $ver['ver'];
$hosturl = urlencode('http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']);
$updatehost = 'http://demo.weiqianlong.com/update.php';
$updatehosturl = $updatehost . '?a=update&v=' . $ver . '&u=' . $hosturl;
$updatenowinfo = file_get_contents($updatehosturl);
if (strstr($updatenowinfo, 'zip')){
$pathurl = $updatehost . '?a=down&f=' . $updatenowinfo;
$updatedir = './WQLData/logs/Temp/update';
delDirAndFile($updatedir);
get_file($pathurl, $updatenowinfo, $updatedir);
$updatezip = $updatedir . '/' . $updatenowinfo;
$archive = new PclZip($updatezip);
if ($archive -> extract(PCLZIP_OPT_PATH, './', PCLZIP_OPT_REPLACE_NEWER) == 0){
$updatenowinfo = "远程升级文件不存在.升级失败</font>";
}else{
$sqlfile = $updatedir . '/update.sql';
$sql = file_get_contents($sqlfile);
if($sql){
$sql = str_replace("tp_", C('DB_PREFIX'), $sql);
$Model = new Model();
error_reporting(0);
foreach(split(";[\r\n]+", $sql) as $v){
@mysql_query($v);
}
}
$updatenowinfo = "<font color=red>升级完成 {$sqlinfo}</font><span><a href=./index.php?g=System&m=Update>点击这里 查看是否还有升级包</a></span>";
}
}
delDirAndFile($updatedir);
$this -> assign('updatenowinfo', $updatenowinfo);
$this -> display();
}
示例9: delDirAndFile
function delDirAndFile($dirName)
{
if ($handle = opendir($dirName)) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir($dirName . '/' . $item)) {
delDirAndFile($dirName . '/' . $item);
} else {
if (unlink($dirName . '/' . $item)) {
}
}
}
}
closedir($handle);
if (rmdir($dirName)) {
}
}
}
示例10: delDirAndFile
/**
* 删除目录及目录下所有文件或删除指定文件
* @param str $path 待删除目录路径
* @param int $delDir 是否删除目录,1或true删除目录,0或false则只删除文件保留目录(包含子目录)
* @return bool 返回删除状态
*/
protected function delDirAndFile($path, $delDir = FALSE)
{
$message = "";
$handle = opendir($path);
if ($handle) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir("{$path}/{$item}")) {
$msg = delDirAndFile("{$path}/{$item}", $delDir);
if ($msg) {
$message .= $msg;
}
} else {
$message .= "删除文件" . $item;
if (unlink("{$path}/{$item}")) {
$message .= "成功<br />";
} else {
$message .= "失败<br />";
}
}
}
}
closedir($handle);
if ($delDir) {
if (rmdir($path)) {
$message .= "删除目录" . dirname($path) . "<br />";
} else {
$message .= "删除目录" . dirname($path) . "失败<br />";
}
}
} else {
if (file_exists($path)) {
if (unlink($path)) {
$message .= "删除文件" . basename($path) . "<br />";
} else {
$message .= "删除文件" + basename($path) . "失败<br />";
}
} else {
$message .= "文件" + basename($path) . "不存在<br />";
}
}
return $message;
}
示例11: delDirAndFile
function delDirAndFile($dirName)
{
if ($handle = opendir("{$dirName}")) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir("{$dirName}/{$item}")) {
delDirAndFile("{$dirName}/{$item}");
} else {
if (unlink("{$dirName}/{$item}")) {
echo "成功删除文件: {$dirName}/{$item}<br />\n";
}
}
}
}
closedir($handle);
if (rmdir($dirName)) {
echo "成功删除目录: {$dirName}<br />\n";
}
}
}
示例12: delDirAndFile
function delDirAndFile($dirName, $echo = 1, $echotxt = '更新缓存')
{
if ($handle = opendir("{$dirName}")) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir("{$dirName}/{$item}")) {
delDirAndFile("{$dirName}/{$item}");
} else {
if (unlink("{$dirName}/{$item}") && $echo == 1) {
echo $echotxt . ": {$dirName}/{$item}<br />\n";
}
}
}
}
closedir($handle);
if (rmdir($dirName) && $echo == 1) {
echo $echotxt . ": {$dirName}<br />\n";
}
}
return TRUE;
}
示例13: delDirAndFile
function delDirAndFile($dirName, $root)
{
$rootfolder = $root;
if ($handle = opendir("{$dirName}")) {
while (false !== ($item = readdir($handle))) {
if ($item != "." && $item != "..") {
if (is_dir("{$dirName}/{$item}")) {
delDirAndFile("{$dirName}/{$item}", $root);
} else {
if (unlink("{$dirName}/{$item}")) {
echo "成功删除文件: {$dirName}/{$item}\\</br>";
}
}
}
}
closedir($handle);
if ($dirName != $rootfolder . '/Cache' && $dirName != $rootfolder . '/Temp' && $dirName != $rootfolder . '/Data') {
if (rmdir($dirName)) {
echo "成功删除目录: {$dirName}\n";
}
}
}
}
示例14: checkSystemConfig
/**
+----------------------------------------------------------
* 网站配置信息保存操作等
+----------------------------------------------------------
*/
private function checkSystemConfig($obj = "SITE_INFO")
{
if (IS_POST) {
$this->checkToken();
$config = WEB_ROOT . "Common/systemConfig.php";
$config = file_exists($config) ? include "{$config}" : array();
$config = is_array($config) ? $config : array();
$config = array_merge($config, array("{$obj}" => $_POST));
$str = $obj == "SITE_INFO" ? "网站配置信息" : $obj == "SYSTEM_EMAIL" ? "系统邮箱配置" : "安全设置";
if (F("systemConfig", $config, WEB_ROOT . "Common/")) {
delDirAndFile(WEB_CACHE_PATH . "Runtime/Admin/~runtime.php");
if ($obj == "TOKEN") {
unset($_SESSION, $_COOKIE);
echo json_encode(array('status' => 1, 'info' => $str . '已更新,你需要重新登录', 'url' => __APP__ . '?' . time()));
} else {
echo json_encode(array('status' => 1, 'info' => $str . '已更新'));
}
} else {
echo json_encode(array('status' => 0, 'info' => $str . '失败,请检查', 'url' => __ACTION__));
}
} else {
$this->display();
}
}
示例15: cache
public function cache()
{
// $caches = array(
// "allCache" => WEB_CACHE_PATH,
// "allRunCache" => WEB_CACHE_PATH . "Runtime/",
// "allAdminRunCache" => WEB_CACHE_PATH . "Runtime/Admin/",
// "allHomeRunCache" => WEB_CACHE_PATH . "Runtime/Home/",
// "allHomeRunCache" => WEB_CACHE_PATH . "Runtime/Home/",
// );
$caches = array("HomeCache" => array("name" => "网站前台缓存文件", "path" => WEB_CACHE_PATH . "Home/Cache/"), "AdminCache" => array("name" => "网站后台缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/Cache/"), "HomeData" => array("name" => "网站前台数据库字段缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Home/Data/"), "AdminData" => array("name" => "网站后台数据库字段缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/Data/"), "HomeLog" => array("name" => "网站前台日志缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Home/Logs/"), "AdminLog" => array("name" => "网站后台日志缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/Logs/"), "HomeTemp" => array("name" => "网站前台临时缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Home/Temp"), "AdminTemp" => array("name" => "网站后台临时缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/Temp"), "Homeruntime" => array("name" => "网站前台runtime.php缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Home/~runtime.php"), "Adminruntime" => array("name" => "网站后台runtime.php缓存文件", "path" => WEB_CACHE_PATH . "Runtime/Admin/~runtime.php"), "MinFiles" => array("name" => "JS\\CSS压缩缓存文件", "path" => WEB_CACHE_PATH . "MinFiles/"));
if (IS_POST) {
foreach ($_POST['cache'] as $path) {
if (isset($caches[$path])) {
delDirAndFile($caches[$path]['path']);
}
}
// pre($_POST);
// $this->checkToken();
echo json_encode(array("status" => 1, "info" => "缓存文件已清除"));
} else {
$this->assign("caches", $caches);
$this->display();
}
}