本文整理匯總了PHP中Dir::delDirnotself方法的典型用法代碼示例。如果您正苦於以下問題:PHP Dir::delDirnotself方法的具體用法?PHP Dir::delDirnotself怎麽用?PHP Dir::delDirnotself使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Dir
的用法示例。
在下文中一共展示了Dir::delDirnotself方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: add
public function add()
{
$gets = $this->_get('style');
$db = M('Merchant_info');
include './cms/Lib/ORG/index.Tpl.php';
foreach ($tpl as $k => $v) {
if ($gets == $v['tpltypeid']) {
$data['tpltypeid'] = $v['tpltypeid'];
$data['tpltypename'] = $v['tpltypename'];
}
}
$where['token'] = $this->token;
$db->where($where)->save($data);
M('Home')->where(array('token' => $this->token))->save(array('advancetpl' => 0));
import('ORG.Util.Dir');
Dir::delDirnotself('./runtime');
if (isset($_GET['noajax'])) {
$this->success('設置成功', '/merchant.php?g=Merchant&c=Tmpls&a=index&token=' . $this->token);
}
}
示例2: amend
public function amend()
{
if (IS_POST) {
$database_config = D('Config');
foreach ($_POST as $key => $value) {
$data['name'] = $key;
$data['value'] = trim(stripslashes(htmlspecialchars_decode($value)));
$database_config->data($data)->where(array("name" => $key))->save();
if ($key == 'wechat_sourceid') {
$data['name'] = 'wechat_token';
$data['value'] = md5('pigcms_wechat_token' . $data['value']);
$database_config->data($data)->where(array("name" => 'wechat_token'))->save();
}
}
import('ORG.Util.Dir');
Dir::delDirnotself('./cache');
$this->success('修改成功!');
} else {
$this->error('非法提交,請重新提交~');
}
}
示例3: cache
public function cache()
{
import('ORG.Util.Dir');
Dir::delDirnotself('./runtime');
$this->frame_main_ok_tips('清除緩存成功!');
}
示例4: styleChange
public function styleChange()
{
$db = D('Home');
$info = $db->where(array('token' => $this->token))->find();
$radiogroup = $this->_get('radiogroup');
$token = $this->token;
$data['radiogroup'] = $radiogroup;
if ($info == false) {
$data['token'] = $this->token;
$res = $db->add($data);
} else {
$data['id'] = $info['id'];
$res = $db->save($data);
}
import('ORG.Util.Dir');
Dir::delDirnotself('./runtime');
}
示例5: adver_del
public function adver_del()
{
$database_adver = D('Adver');
$condition_adver['id'] = $_POST['id'];
$now_adver = $database_adver->field(true)->where($condition_adver)->find();
if ($database_adver->where($condition_adver)->delete()) {
unlink('./upload/' . $now_adver['pic']);
$attachment_upload_type = C('config.attachment_upload_type');
// 刪除又拍雲服務器
if ($attachment_upload_type == '1') {
import('upyunUser', './source/class/upload/');
upyunUser::delete('/' . $now_adver['pic']);
}
S('adver_list_' . $now_adver['cat_id'], NULL);
// 清空緩存
import('ORG.Util.Dir');
Dir::delDirnotself('./cache');
$this->success('刪除成功');
} else {
$this->error('刪除失敗!請重試~');
}
}
示例6: delDirnotself
/**
+----------------------------------------------------------
* 清空目錄下的所有文件和目錄,但是保留本身
+----------------------------------------------------------
* @access static
+----------------------------------------------------------
* @return void
+----------------------------------------------------------
*/
function delDirnotself($directory, $notself = false)
{
if (is_dir($directory) == false) {
return '1';
}
$handle = opendir($directory);
while (($file = readdir($handle)) !== false) {
if ($file != "." && $file != "..") {
if (is_dir("{$directory}/{$file}")) {
Dir::delDirnotself("{$directory}/{$file}", true);
} else {
unlink("{$directory}/{$file}");
}
}
}
if (readdir($handle) == false) {
closedir($handle);
if ($notself) {
rmdir($directory);
}
}
}