当前位置: 首页>>代码示例>>PHP>>正文


PHP FileUtil::createFile方法代码示例

本文整理汇总了PHP中FileUtil::createFile方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtil::createFile方法的具体用法?PHP FileUtil::createFile怎么用?PHP FileUtil::createFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FileUtil的用法示例。


在下文中一共展示了FileUtil::createFile方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: actionCropImg

 public function actionCropImg()
 {
     if (EnvUtil::submitCheck("userSubmit")) {
         $params = $_POST;
         if (!isset($params) && empty($params)) {
             return null;
         }
         $tempAvatar = $params["src"];
         $avatarPath = "data/avatar/";
         $avatarBig = UserUtil::getAvatar($params["uid"], "big");
         $avatarMiddle = UserUtil::getAvatar($params["uid"], "middle");
         $avatarSmall = UserUtil::getAvatar($params["uid"], "small");
         if (LOCAL) {
             FileUtil::makeDirs($avatarPath . dirname($avatarBig));
         }
         FileUtil::createFile("data/avatar/" . $avatarBig, "");
         FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
         FileUtil::createFile("data/avatar/" . $avatarSmall, "");
         Ibos::import("ext.ThinkImage.ThinkImage", true);
         $imgObj = new ThinkImage(THINKIMAGE_GD);
         $imgObj->open($tempAvatar)->crop($params["w"], $params["h"], $params["x"], $params["y"])->save($tempAvatar);
         $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
         $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
         $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
         $this->success(Ibos::lang("Upload avatar succeed"), $this->createUrl("home/personal", array("op" => "avatar")));
         exit;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:28,代码来源:InfoController.php

示例2: SaveJsonData

function SaveJsonData($category, $start, $end, $file_Path)
{
    $rows = array();
    $query2 = " select pro_id ,title ,img_url ,detail_url ,shop_name ,price ,month_sold ,comm_percent ,seller_ww ,back_BB ,";
    $query2 .= " short_tbk_url ,tbk_url ,commission ,earn ,img_list ,show_order ,P.cat_id ,entrydate ,disabled ";
    $query2 .= " from BS_ProInfo AS P";
    $query2 .= " join BS_Category as C on P.cat_id=C.cat_id";
    $query2 .= " where P.disabled=0 and C.category ='{$category}'";
    $query2 .= " limit {$start}, {$end}";
    // echo $query2;
    // exit();
    $result2 = mysqli_query(connect(), $query2);
    while (@($row = mysqli_fetch_assoc($result2))) {
        $rows[] = $row;
    }
    //random order
    shuffle($rows);
    // echo $filename;
    // echo $query2;
    // echo "<br>";
    if (!file_exists($file_Path)) {
        // 文件所在目录
        // echo dirname($json_path);
        // mkdir($json_path, 0777);
        FileUtil::createFile($file_Path);
    }
    // 修改文件权限为读写可执行
    // Read 4 - 允许读文件
    // Write 2 - 允许写/修改文件
    // eXecute1 - 读/写/删除/修改/目录
    chmod($file_Path, 0777);
    file_put_contents($file_Path, json_encode($rows));
}
开发者ID:wancy86,项目名称:BS_PHP,代码行数:33,代码来源:admin_gen_json.php

示例3: updateSql

 function updateSql($SqlUrl)
 {
     if (!file_exists($SqlUrl)) {
         return false;
     } else {
         //SQL更新日志,拼接路径与SQL更新文件相同,名称固定为$SqlLog.txt
         $log = substr($SqlUrl, 0, strrpos($SqlUrl, '/'));
         $log = substr($log, -1) == '/' ? $log : $log . '/';
         $log .= "SqlLog.txt";
         FileUtil::createFile($log);
         $this->sqlQuery($SqlUrl, $log);
     }
 }
开发者ID:tmlsoft,项目名称:main,代码行数:13,代码来源:DoUpgradeAction.class.php

示例4: getOrCreateApplicationBean

 private static function getOrCreateApplicationBean($className)
 {
     try {
         $appBeans = self::getAppBeans();
     } catch (FileNotExistsException $e) {
         FileUtil::createFile(self::APP_SCOPE_FILE);
         $appBeans = array();
     }
     if (!isset($appBeans[$className])) {
         $appBeans[$className] = new $className();
         self::storeAppBeans($appBeans);
     }
     return $appBeans[$className];
 }
开发者ID:aeberh,项目名称:php-movico,代码行数:14,代码来源:BeanLocator.php

示例5: makeThumb

 public static function makeThumb($attach, $width, $height)
 {
     $attachUrl = FileUtil::getAttachUrl();
     $file = sprintf("%s/%s", $attachUrl, $attach["attachment"]);
     $fileext = StringUtil::getFileExt($file);
     $thumbName = self::getThumbName($attach, $width, $height);
     if (LOCAL) {
         $res = ImageUtil::thumb2($file, $thumbName, "", $width, $height);
     } else {
         $tempFile = FileUtil::getTempPath() . "tmp." . $fileext;
         $orgImgname = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($file), $fileext);
         ImageUtil::thumb2($orgImgname, $tempFile, "", $width, $height);
         FileUtil::createFile($thumbName, file_get_contents($tempFile));
     }
     return $thumbName;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:16,代码来源:WbCommonUtil.php

示例6: setCommonBg

 private function setCommonBg($src)
 {
     $bgPath = "data/home/";
     $random = StringUtil::random(16);
     $bgBig = $random . "_big.jpg";
     $bgMiddle = $random . "_middle.jpg";
     $bgSmall = $random . "_small.jpg";
     FileUtil::createFile($bgPath . $bgBig, "");
     FileUtil::createFile($bgPath . $bgMiddle, "");
     FileUtil::createFile($bgPath . $bgSmall, "");
     Ibos::import("ext.ThinkImage.ThinkImage", true);
     $imgObj = new ThinkImage(THINKIMAGE_GD);
     $imgObj->open($src)->thumb(1000, 300, 1)->save($bgPath . $bgBig);
     $imgObj->open($src)->thumb(520, 156, 1)->save($bgPath . $bgMiddle);
     $imgObj->open($src)->thumb(400, 120, 1)->save($bgPath . $bgSmall);
     $data = array("desc" => "", "status" => 0, "system" => 0, "image" => $random);
     $addRes = BgTemplate::model()->add($data);
     return $addRes;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:19,代码来源:SkinController.php

示例7: actionUpload

 public function actionUpload()
 {
     if ($_FILES["avatar"]) {
         $upload = FileUtil::getUpload($_FILES["avatar"]);
         if (!$upload->save()) {
             echo "出错了";
         } else {
             $info = $upload->getAttach();
             $file = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachment"];
             $fileUrl = FileUtil::fileName($file);
             $uid = Yii::app()->user->uid;
             $tempAvatar = $file;
             $avatarPath = "data/avatar/";
             $avatarBig = UserUtil::getAvatar($uid, "big");
             $avatarMiddle = UserUtil::getAvatar($uid, "middle");
             $avatarSmall = UserUtil::getAvatar($uid, "small");
             if (LOCAL) {
                 FileUtil::makeDirs($avatarPath . dirname($avatarBig));
             }
             FileUtil::createFile("data/avatar/" . $avatarBig, "");
             FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
             FileUtil::createFile("data/avatar/" . $avatarSmall, "");
             Yii::import("ext.ThinkImage.ThinkImage", true);
             $imgObj = new ThinkImage(THINKIMAGE_GD);
             $imgTemp = $imgObj->open($tempAvatar);
             $params = array("w" => $imgTemp->width(), "h" => $imgTemp->height(), "x" => "0", "y" => "0");
             if ($params["h"] < $params["w"]) {
                 $params["x"] = ($params["w"] - $params["h"]) / 2;
                 $params["w"] = $params["h"];
             } else {
                 $params["y"] = ($params["h"] - $params["w"]) / 2;
                 $params["h"] = $params["w"];
             }
             $imgObj->open($tempAvatar)->crop($params["w"], $params["h"], $params["x"], $params["y"])->save($tempAvatar);
             $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
             $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
             $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
         }
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:40,代码来源:settingController.php

示例8: createStaticJs

 private static function createStaticJs()
 {
     CacheUtil::load(array("department", "position"), true);
     $unit = Ibos::app()->setting->get("setting/unit");
     $department = DepartmentUtil::loadDepartment();
     $users = UserUtil::loadUser();
     $position = PositionUtil::loadPosition();
     $positionCategory = PositionUtil::loadPositionCategory();
     $companyData = self::initCompany($unit);
     $deptData = self::initDept($department);
     $userData = self::initUser($users);
     $posData = self::initPosition($position);
     $posCatData = self::initPositionCategory($positionCategory);
     $default = file_get_contents(PATH_ROOT . "/static/js/src/org.default.js");
     if ($default) {
         $patterns = array("/\\{\\{(company)\\}\\}/", "/\\{\\{(department)\\}\\}/", "/\\{\\{(position)\\}\\}/", "/\\{\\{(users)\\}\\}/", "/\\{\\{(positioncategory)\\}\\}/");
         $replacements = array($companyData, $deptData, $posData, $userData, $posCatData);
         $new = preg_replace($patterns, $replacements, $default);
         FileUtil::createFile("data/org.js", $new);
         CacheUtil::update("setting");
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:22,代码来源:OrgUtil.php

示例9: actionPostimg

 public function actionPostimg()
 {
     $upload = FileUtil::getUpload($_FILES["pmimage"], "mobile");
     if (!$upload->save()) {
         echo "出错了";
     } else {
         $info = $upload->getAttach();
         $file = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachment"];
         $fileUrl = FileUtil::fileName($file);
         $filePath = FileUtil::getAttachUrl() . "/" . $info["type"] . "/" . $info["attachdir"];
         $filename = "tumb_" . $info["attachname"];
         if (LOCAL) {
             FileUtil::makeDirs($filePath . dirname($filename));
         }
         FileUtil::createFile($filePath . $filename, "");
         Yii::import("ext.ThinkImage.ThinkImage", true);
         $imgObj = new ThinkImage(THINKIMAGE_GD);
         $imgObj->open($fileUrl)->thumb(180, 180, 1)->save($filePath . $filename);
         $content = "<a href='" . $fileUrl . "'><img src='" . $filePath . $filename . "' /></a>";
         $id = intval(isset($_POST["pmid"]) ? $_POST["pmid"] : 0);
         $touid = intval(isset($_POST["pmtouid"]) ? $_POST["touid"] : 0);
         if (!$id && $touid) {
             $data = array("content" => $content, "touid" => $touid, "type" => 1);
             $res = MessageContent::model()->postMessage($data, Yii::app()->user->uid);
             $message = array("listid" => $res, "IsSuccess" => true);
         } else {
             $res = MessageContent::model()->replyMessage($id, $content, Yii::app()->user->uid);
             if ($res) {
                 $message = array("IsSuccess" => true, "data" => Ibos::lang("Private message send success"));
             } else {
                 $message = array("IsSuccess" => false, "data" => Ibos::lang("Private message send fail"));
             }
         }
         $this->ajaxReturn($message, "JSONP");
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:36,代码来源:PmController.php

示例10: json_encode

$pid = $_POST['parent_id'];
$date = $_POST['t'];
$title = $_POST['title'];
$author = $_POST['author'];
$content = $_POST['content'];
//POST packed Article
$wrapper = new HtmlArtWrapper();
$wrapper->wrap($title, $author, $date, $content);
//write file
$domain = "http://localhost/ncg/";
$preffix = "public/articles";
$subffix = ".html";
$fu = new FileUtil();
$dir = $preffix . '/' . date("Y/m/d/");
$diff = mktime() - filemtime($dir);
if ($diff < 10) {
    //1分钟之内不可写
    $res['isSuccess'] = false;
    $res['errorMess'] = "Write file to fast, " + $diff;
    exit(json_encode($res));
}
$url = $preffix . '/' . date("Y/m/d/") . md5(mktime()) . $subffix;
$fu->createFile($url);
$contents = $wrapper->getPanel();
iconv('UTF8', 'GB2312', $contents);
$tag = file_put_contents($url, $contents);
$res['isSuccess'] = $tag > 0;
if ($tag) {
    $res['directUrl'] = $domain . $url;
}
echo json_encode($res);
开发者ID:overkazaf,项目名称:ncg,代码行数:31,代码来源:temp.php

示例11: getEmailSize

 public static function getEmailSize($content, $attachmentId = "")
 {
     $tmpfile = "data/emailsize.temp";
     FileUtil::createFile($tmpfile, $content);
     $emailContentSize = FileUtil::fileSize($tmpfile);
     FileUtil::deleteFile($tmpfile);
     $attFileSize = 0;
     if (!empty($attachmentId)) {
         $attach = AttachUtil::getAttachData($attachmentId, false);
         foreach ($attach as $value) {
             $attFileSize += intval($value["filesize"]);
         }
     }
     return intval($emailContentSize + $attFileSize);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:15,代码来源:EmailUtil.php

示例12: addPicture

 private function addPicture($attach, $articleId)
 {
     $sort = 0;
     foreach ($attach as $value) {
         $picture = array("articleid" => $articleId, "aid" => $value["aid"], "sort" => $sort, "addtime" => TIMESTAMP, "postip" => StringUtil::getSubIp(), "filename" => $value["filename"], "title" => "", "type" => $value["filetype"], "size" => $value["filesize"], "filepath" => $value["attachment"]);
         if (Yii::app()->setting->get("setting/articlethumbenable")) {
             list($thumbWidth, $thumbHeight) = explode(",", Yii::app()->setting->get("setting/articlethumbwh"));
             $imageInfo = ImageUtil::getImageInfo(FileUtil::fileName($picture["filepath"]));
             if ($imageInfo["width"] < $thumbWidth && $imageInfo["height"] < $thumbHeight) {
                 $picture["thumb"] = 0;
             } else {
                 $sourceFileName = explode("/", $picture["filepath"]);
                 $sourceFileName[count($sourceFileName) - 1] = "thumb_" . $sourceFileName[count($sourceFileName) - 1];
                 $thumbName = implode("/", $sourceFileName);
                 if (LOCAL) {
                     ImageUtil::thumb($picture["filepath"], $thumbName, $thumbWidth, $thumbHeight);
                 } else {
                     $tempFile = FileUtil::getTempPath() . "tmp." . $picture["type"];
                     $orgImgname = Ibos::engine()->IO()->file()->fetchTemp(FileUtil::fileName($picture["filepath"]), $picture["type"]);
                     ImageUtil::thumb($orgImgname, $tempFile, $thumbWidth, $thumbHeight);
                     FileUtil::createFile($thumbName, file_get_contents($tempFile));
                 }
                 $picture["thumb"] = 1;
             }
         }
         ArticlePicture::model()->add($picture);
         $sort++;
     }
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:29,代码来源:DefaultController.php

示例13: createImgIcon

 private function createImgIcon($tempFile, $outputName)
 {
     $outputFile = $this->_iconPath . $outputName;
     FileUtil::createFile($outputFile, "");
     Ibos::import("ext.ThinkImage.ThinkImage", true);
     $imgObj = new ThinkImage(THINKIMAGE_GD);
     $imgObj->open($tempFile)->save($outputFile);
     return true;
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:9,代码来源:QuicknavController.php

示例14: cropImg

 private function cropImg()
 {
     $uid = Ibos::app()->user->uid;
     $tempAvatar = $_POST["src"];
     $avatarPath = "data/avatar/";
     $avatarBig = UserUtil::getAvatar($uid, "big");
     $avatarMiddle = UserUtil::getAvatar($uid, "middle");
     $avatarSmall = UserUtil::getAvatar($uid, "small");
     if (LOCAL) {
         FileUtil::makeDirs($avatarPath . dirname($avatarBig));
     }
     FileUtil::createFile("data/avatar/" . $avatarBig, "");
     FileUtil::createFile("data/avatar/" . $avatarMiddle, "");
     FileUtil::createFile("data/avatar/" . $avatarSmall, "");
     Ibos::import("ext.ThinkImage.ThinkImage", true);
     $imgObj = new ThinkImage(THINKIMAGE_GD);
     $imgObj->open($tempAvatar)->thumb(180, 180, 1)->save($avatarPath . $avatarBig);
     $imgObj->open($tempAvatar)->thumb(60, 60, 1)->save($avatarPath . $avatarMiddle);
     $imgObj->open($tempAvatar)->thumb(30, 30, 1)->save($avatarPath . $avatarSmall);
 }
开发者ID:AxelPanda,项目名称:ibos,代码行数:20,代码来源:DefaultController.php


注:本文中的FileUtil::createFile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。