本文整理汇总了PHP中FileUtils::createDir方法的典型用法代码示例。如果您正苦于以下问题:PHP FileUtils::createDir方法的具体用法?PHP FileUtils::createDir怎么用?PHP FileUtils::createDir使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FileUtils
的用法示例。
在下文中一共展示了FileUtils::createDir方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveBookletImage
private static function saveBookletImage($bookletCode, $imageName, $base64Image)
{
$bookletImagesRoot = DBPreferencesType::getPreferenceS(Constants::BOOKLET_IMAGE_PATH);
$bookletImageDirectory = FileUtils::buildPath($bookletImagesRoot, $bookletCode);
FileUtils::createDir($bookletImageDirectory);
$imageEditor = ImageEditor::newImageBase64($base64Image);
$bookletImagePath = FileUtils::buildPath($bookletImagesRoot, $bookletCode, $imageName);
$imageEditor->saveImage($bookletImagePath);
return FileUtils::buildPath($bookletCode, $imageName);
}
示例2: newImageBase64
public static function newImageBase64($base64)
{
$tmpDir = FileUtils::getTmpDir();
$imageExtension = Utils::getImageExtensionFromBase64($base64);
$imageName = Utils::getRandomString() . '.' . $imageExtension;
$path = FileUtils::buildPath($tmpDir, $imageName);
$base64PrefixLess = Utils::extractBase64($base64);
FileUtils::createDir($tmpDir);
chmod($tmpDir, 0777);
$file = file_put_contents($path, base64_decode($base64PrefixLess));
chmod($path, 0777);
if ($file == true) {
$instance = new ImageEditor($path);
}
return $instance;
}
示例3: updateGood
public static function updateGood($id, $values)
{
if (is_array($values)) {
$goodsType = new DBGoodsType();
if (array_key_exists(DB::TABLE_GOODS__ID, $values)) {
unset($values[DB::TABLE_GOODS__ID]);
}
$pref = new DBPreferencesType();
$imagePath = $pref->getPreference(Constants::CATALOG_PATH);
$imagePath = $imagePath[DB::TABLE_PREFERENCES__VALUE];
$imagesCatalog = $values[DB::TABLE_GOODS__KEY_ITEM];
$isDirCreated = FileUtils::createDir($imagePath . $imagesCatalog);
return $goodsType->update($id, $values);
}
return -1;
}