當前位置: 首頁>>代碼示例>>PHP>>正文


PHP mk_dir函數代碼示例

本文整理匯總了PHP中mk_dir函數的典型用法代碼示例。如果您正苦於以下問題:PHP mk_dir函數的具體用法?PHP mk_dir怎麽用?PHP mk_dir使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了mk_dir函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: delByRoleId

 /**
  * 根據角色ID刪除記錄
  * 
  * @param int       $role_id        角色ID
  * @return bool
  */
 public function delByRoleId($role_id)
 {
     $this->where("roleid={$role_id}")->delete();
     del_dir($this->_cache_path);
     mk_dir($this->_cache_path, 0755);
     return true;
 }
開發者ID:yunsite,項目名稱:tp-coupon,代碼行數:13,代碼來源:AdminUserRoleModel.class.php

示例2: upload

/**
 * 處理$_FILES上傳的文件,返回文件本地路徑
 * @param string $name 上傳表單名
 * @param string $UploadDir 上傳子目錄
 * @param boolean $datedir 是否采用分日期子目錄
 * @return boolean
 */
function upload($name, $UploadDir = 'upload', $datedir = true)
{
    if (empty($_FILES) || !isset($_FILES[$name])) {
        return false;
    }
    if ($_FILES[$name]['name'] != '') {
        $file = new UploadFile();
        $file->Path = FUN_ROOT;
        $file->UploadDir = $UploadDir;
        if ($datedir) {
            $file->UploadDir .= date('/Ym');
        }
        if (!is_dir(mk_dir($file->Path . $file->UploadDir))) {
            return false;
        }
        $filename = $file->uploading($name);
        if ($file->Uploaded) {
            //$filename = basename($filename);
            return $filename;
        } else {
            print_r($file->Err);
            return false;
        }
    }
}
開發者ID:shiyangwu520,項目名稱:PHPFun,代碼行數:32,代碼來源:http.php

示例3: init_app

 public function init_app($user_info)
 {
     $list = $this->sql->get();
     $new_user_app = $this->config['setting_system']['new_user_app'];
     $default = explode(',', $new_user_app);
     $info = array();
     foreach ($default as $key) {
         $info[$key] = $list[$key];
     }
     $desktop = USER_PATH . $user_info['name'] . '/home/desktop/';
     mk_dir($desktop);
     foreach ($info as $key => $data) {
         if (!is_array($data)) {
             continue;
         }
         $path = iconv_system($desktop . $key . '.oexe');
         unset($data['name']);
         unset($data['desc']);
         unset($data['group']);
         file_put_contents($path, json_encode($data));
     }
     $user_info['status'] = 1;
     $member = new fileCache(USER_SYSTEM . 'member.php');
     $member->update($user_info['name'], $user_info);
 }
開發者ID:zhendeguoke1008,項目名稱:OneShop,代碼行數:25,代碼來源:app.class.php

示例4: upload

 public function upload($allowExts = "jpg,gif,png,jpeg", $savePath = "Upload", $other_param = array())
 {
     class_exists("UploadFile") or import("ORG.Net.UploadFile");
     $upload = new UploadFile();
     //  實例化上傳類
     $upload->allowExts = explode(",", $allowExts);
     //  設置附件上傳類型
     $savePath = $savePath == "/" ? "Upload" : trim($savePath, "/");
     $upload->savePath = ROOT_PATH . "/" . $savePath . "/";
     //  設置附件上傳目錄
     if (!is_dir($upload->savePath)) {
         mk_dir($upload->savePath);
     }
     $other_key = array("maxSize" => 3145728, "saveRule" => "uniqid", "hashType" => null, "autoCheck" => null, "uploadReplace" => null, "allowTypes" => null, "thumb" => null, "thumbMaxWidth" => null, "thumbMaxHeight" => null, "thumbPrefix" => null, "thumbSuffix" => null, "thumbPath" => null, "thumbFile" => null, "thumbRemoveOrigin" => null, "autoSub" => true, "subType" => "date", "dateFormat" => "Ym", "hashLevel" => 1);
     foreach ($other_key as $key => $val) {
         if (isset($other_param[$key])) {
             $upload->{$key} = $other_param[$key];
         } elseif ($val !== null) {
             $upload->{$key} = $val;
         }
     }
     if (!$upload->upload()) {
         //  上傳錯誤 提示錯誤信息
         $result = array("status" => false, "Msg" => $upload->getErrorMsg(), "info" => null);
     } else {
         //  上傳成功 獲取上傳文件信息
         $result = array("status" => true, "Msg" => "上傳成功", "info" => $upload->getUploadFileInfo());
     }
     return $result;
 }
開發者ID:baowzh,項目名稱:adminrightlist,代碼行數:30,代碼來源:uploadifyAction.class.php

示例5: detail

 /**
  * 快遞查詢
  */
 public function detail()
 {
     $data['id'] = $_GET['id'];
     $vo = $this->db->where($data)->find();
     $this->assign('vo', $vo);
     if (!$vo) {
         $this->error('物流信息不存在');
     }
     $dir = get_dir($vo['id']);
     if (file_exists(C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/list.php')) {
         $list = (include C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/list.php');
     } else {
         include C('PUBLIC_INCLUDE') . "kuaidi.class.php";
         $kuaidi = new kuaidi();
         $list = $kuaidi->query($vo['shipping_code'], $vo['shipping_no']);
         krsort($list['data']);
         mk_dir(C('DATA_CACHE_PATH') . '/delivery/');
         if ($list['state'] == 3) {
             mk_dir(C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/');
             F('list', $list, C('DATA_CACHE_PATH') . '/delivery/' . $dir . '/');
         }
     }
     if ($list) {
         $list['count'] = count($list['data']);
     } else {
         $list['message'] = $kuaidi->error;
     }
     if (!$list) {
         $this->error($kuaidi->getError());
     } else {
         $result['data'] = $list;
         $result['notice'] = '查詢成功';
         ajaxSucReturn($result);
     }
 }
開發者ID:8yong8,項目名稱:vshop,代碼行數:38,代碼來源:OrderDeliveryController.class.php

示例6: getAccessToken

  private function getAccessToken() {
	$path = $this->cacheDir.'/access_token.json';
	$status = file_exists($path);
	if($status){
	  $data = json_decode(file_get_contents($path),1);
	}else{
	  mk_dir($this->cacheDir);
	}
    if ($status || $data['expire_time'] < time()) {
      $url = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=$this->appId&secret=$this->appSecret";
	  $res = json_decode($this->httpGet($url));
      $access_token = $res->access_token;
      if ($access_token) {
        $data['expire_time'] = time() + 7000;
        $data['access_token'] = $access_token;
		file_put_contents($path,json_encode($data));
		//cookie('wx_access_token',json_encode($data),7200);
        /*$fp = fopen("access_token.json", "w");
        fwrite($fp, json_encode($data));
        fclose($fp);*/
      }
    } else {
      $access_token = $data->access_token;
    }
    return $access_token;
  }
開發者ID:8yong8,項目名稱:vshop,代碼行數:26,代碼來源:jssdk.php

示例7: copydir

function copydir($source, $destination)
{
    $source = dirpath($source);
    $destination = dirpath($destination);
    $result = true;
    if (!is_dir($source)) {
        //讀取源目錄
        msg("源目錄名稱錯誤", 0);
    }
    if (!is_dir($destination)) {
        //讀取目標目錄
        if (!mk_dir($destination)) {
            msg("無法創建目標目錄", 0);
        }
    }
    $handle = opendir($source);
    //取得目錄的句柄
    while (($file = readdir($handle)) !== false) {
        if ($file != '.' && $file != '..') {
            $src = $source . "/" . $file;
            //源文件路徑
            $dtn = $destination . "/" . $file;
            //目標文件路徑
            if (is_dir($src)) {
                copydir($src, $dtn);
            } else {
                copyfile($src, $dtn);
            }
            //msg($src.'--->'.$dtn.'<br>');
        }
    }
    closedir($handle);
    return $result;
}
開發者ID:lee99,項目名稱:thinksetup,代碼行數:34,代碼來源:common.php

示例8: _upload

 public function _upload($module, $path, $thumb, $width, $height)
 {
     $module = $module = "" ? 'file' : $module;
     //未知模塊將存入file文件夾
     switch ($module) {
         case 'img':
             $path = C(ATTACHPATH) . '/img/' . $path . '/';
             break;
         default:
             $path = C(ATTACHPATH) . '/file/' . $path . '/';
     }
     if (!is_dir($path)) {
         mk_dir($path);
     }
     import("ORG.Net.UploadFile");
     $upload = new UploadFile();
     $upload->maxSize = C(ATTACHSIZE);
     $upload->allowExts = C(ATTACHEXT);
     $upload->savePath = $path;
     $upload->saveRule = 'uniqid';
     isset($thumb) ? $upload->thumb = $thumb : ($upload->thumb = C(ATTACH));
     isset($width) ? $upload->thumbMaxWidth = $width : ($upload->thumbMaxWidth = C(THUMBMAXWIDTH));
     isset($height) ? $upload->thumbMaxHeight = $height : ($upload->thumbMaxHeight = C(THUMBMAXHEIGHT));
     $upload->thumbSuffix = C(THUMBSUFFIX);
     //$upload->thumbMaxWidth =C(THUMBMAXWIDTH);
     //$upload->thumbMaxHeight =C(THUMBMAXHEIGHT);
     if (!$upload->upload()) {
         //捕獲上傳異常
         return $this->error($upload->getErrorMsg());
     } else {
         //上傳成功
         return $upload->getUploadFileInfo();
     }
 }
開發者ID:rust1989,項目名稱:ddsfilm,代碼行數:34,代碼來源:GobalAction.class.php

示例9: Set

  /**
   * 設置緩存
   */
  public function Set(){
	  $name  = $_POST['name'];
	  $value  = json_decode($_POST['json_data'],true);
	  $expire = $_POST['expire'] ? $_POST['expire'] : C('DATA_CACHE_TIME');
	  if(C('DATA_CACHE_TYPE')=='Memcache'){
		$expire = $expire==-1 ? 0 : $expire;
		$name = $_POST['module'].':'.$_POST['name'];
	  }
	  $expire = $_POST['expire'] ? $_POST['expire'] : 0;
	  $dir = $_POST['dir'] ? $_POST['dir'] : '';
	  $options['temp'] = C('DATA_CACHE_PATH').$dir;
	  //創建目錄
	  if(C('DATA_CACHE_TYPE')=='File')mk_dir(C('DATA_CACHE_PATH').$dir);
	  $options['filename'] = $name;
	  $cache = new Cache();
	  $cache =$cache->connect(C('DATA_CACHE_TYPE'),$options);
	  $cache->getInstance();
	  $result = $cache->set($name,$value,$expire);
	  if($_POST['from']=='self'){
	    return;
	  }
	  if($result){
	    $msg['error_code'] = 0;
	  }else{
	    $msg['error_code'] = 8002;
	  }
	  echo json_encode($msg);exit;
  }
開發者ID:8yong8,項目名稱:vshop,代碼行數:31,代碼來源:LocalController.class.php

示例10: flash_upload_insert

 public function flash_upload_insert()
 {
     //dump($_FILES['Filedata']);exit;
     if (!isset($_POST['sessid'])) {
         exit;
     } else {
         session_id($_POST['sessid']);
     }
     $name = uniqid();
     $msg['ok'] = 'yes';
     $path = C('IMG_ROOT') . date('Y') . '/' . date('m') . '/' . date('d') . '/';
     mk_dir($path);
     $array = explode('.', $_FILES['Filedata']['name']);
     $type = array_pop($array);
     $up_name = array_shift($array);
     move_uploaded_file($_FILES['Filedata']['tmp_name'], $path . $name . '.' . $type);
     $msg['file_url'] = C('IMG_URL') . date('Y') . '/' . date('m') . '/' . date('d') . '/' . $name . '.' . $type;
     $msg['file_name'] = $up_name;
     $msg['text'] = '<a href="' . C('IMG_URL') . date('Y') . '/' . date('m') . '/' . date('d') . '/' . $name . '.' . $type . '" target="_blank">' . $up_name . '</a>';
     /*
     //添加附件信息
     $model = M('attachments');
     $add_data['source'] = $_POST['doaction'];
     $add_data['filename'] = $up_name;
     $add_data['title'] = $up_name;
     $add_data['type'] = $_FILES['Filedata']['type'];
     $add_data['size'] = $_FILES['Filedata']['size'];
     $add_data['filepath'] = C('IMG_URL').date('Y').'/'.date('m').'/'.date('d').'/'.$name.'.'.$type;
     $add_data['hash'] = $_POST['hash'];
     $add_data['size'] = $_FILES['Filedata']['size'];
     $add_data['user_id'] = $_SESSION[C('USER_AUTH_KEY')] ? $_SESSION[C('USER_AUTH_KEY')] : 0;
     */
     echo json_encode($msg);
     exit;
 }
開發者ID:8yong8,項目名稱:vshop,代碼行數:35,代碼來源:UploadifyController.class.php

示例11: upload

function upload($upload, $target = './', $exts = 'jpg,gif,torrent,zip,rar,7z,doc,docx,xls,xlsx,ppt,pptx,mp3,wma,swf,flv,txt', $size = 20, $rename = '')
{
    mk_dir($target);
    if (is_array($upload['name'])) {
        $return = array();
        foreach ($upload["name"] as $k => $v) {
            if (!empty($upload['name'][$k])) {
                $ext = get_ext($upload['name'][$k]);
                if (strpos($exts, $ext) !== false && $upload['size'][$k] < $size * 1024 * 1024) {
                    $name = empty($rename) ? upload_name($ext) : upload_rename($rename, $ext);
                    if (upload_move($upload['tmp_name'][$k], $target . $name)) {
                        $return[] = $name;
                    }
                }
            }
        }
        return $return;
    } else {
        $return = '';
        if (!empty($upload['name'])) {
            $ext = get_ext($upload['name']);
            if (strpos($exts, $ext) !== false && $upload['size'] < $size * 1024 * 1024) {
                $name = empty($rename) ? upload_name($ext) : upload_rename($rename, $ext);
                if (upload_move($upload['tmp_name'], $target . $name)) {
                    $return = $name;
                }
            }
        }
    }
    return $return;
}
開發者ID:q275957304,項目名稱:huanshou,代碼行數:31,代碼來源:function.php

示例12: write_content_to_file_with_uid

function write_content_to_file_with_uid($tuid, $content)
{
    // 生成目錄
    $path = DATA_PATH . "/" . $tuid . "/queue/";
    $file = "";
    $succ = FALSE;
    // hash目錄
    $path .= date('Ymd') . "/";
    if (!file_exists($path)) {
        // 創建目錄
        if (mk_dir($path) !== TRUE) {
            log_error('fail', 'mkdir {$path} fail');
            return "";
        }
    }
    $seq = 0;
    for ($i = 0; $i < 100; $i++, $seq++) {
        $file = $path . "/" . time() . "." . $seq;
        if (file_exists($file)) {
            continue;
        }
        $succ = file_put_contents($file, $content);
        if ($succ === FALSE) {
            continue;
        } else {
            break;
        }
    }
    $file = str_replace(DATA_PATH, DATA_HOST, $file);
    return $file;
}
開發者ID:kyosold,項目名稱:sc,代碼行數:31,代碼來源:utils.php

示例13: _upload

 /**
 	 +------------------------------------------------------------------------------
 	 * 公共 文件上傳方法
 	 +------------------------------------------------------------------------------
 	 * $path    string  上傳路徑
 	 * $maxsize int     上傳文件最大值
 	 * $thumb   boolean 是否生成縮略圖
 	 * $width   int     縮略圖最大寬度
 	 * $height  int     縮略圖最大高度
 	 * $autosub boolean 是否使用子目錄保存文件
 	 +------------------------------------------------------------------------------
 */
 public function _upload($path, $thumb = false, $width, $height, $autosub = false, $maxsize)
 {
     import("ORG.Net.UploadFile");
     $upload = new UploadFile();
     isset($maxsize) ? $upload->maxSize = $maxsize : ($upload->maxSize = 1048576);
     //1M
     isset($path) ? $upload->savePath = $savepath = "./Attachments/" . $path . "/" : ($upload->savePath = "./Attachments/Others/");
     if (!is_dir($savepath)) {
         @mk_dir($savepath);
     }
     $upload->allowExts = explode(',', 'gif,png,jpg,jpeg');
     if ($thumb) {
         $upload->thumb = true;
         $upload->thumbPrefix = '';
         $upload->thumbSuffix = '_thumb';
         isset($wideh) ? $upload->thumbMaxWidth = $width : ($upload->thumbMaxWidth = "300");
         isset($height) ? $upload->thumbMaxHeight = $height : ($upload->thumbMaxHeight = "400");
     }
     if ($autosub) {
         $upload->autoSub = true;
         $upload->subType = 'date';
         $upload->saveRule = time;
         $upload->dateFormat = 'Y/m/d';
     }
     if (!$upload->upload()) {
         $this->error($upload->getErrorMsg());
     } else {
         $imginfo = $upload->getUploadFileInfo();
         $imginfo = $imginfo[0]['savename'];
     }
     return $imginfo;
 }
開發者ID:rohcirtep,項目名稱:easygameengine,代碼行數:44,代碼來源:BaseAction.class.php

示例14: getSavePath

 function getSavePath()
 {
     $savePath = SITE_PATH . '/data/uploads/avatar/' . $this->uid;
     if (!file_exists($savePath)) {
         mk_dir($savePath);
     }
     return $savePath;
 }
開發者ID:laiello,項目名稱:thinksns-2,代碼行數:8,代碼來源:AvatarModel.class.php

示例15: getSaveTempPath

function getSaveTempPath()
{
    $savePath = SITE_PATH . '/data/uploads/temp';
    if (!file_exists($savePath)) {
        mk_dir($savePath);
    }
    return $savePath;
}
開發者ID:armebayelm,項目名稱:thinksns-vietnam,代碼行數:8,代碼來源:function.php


注:本文中的mk_dir函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。