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


PHP Random::newHexString方法代码示例

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


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

示例1: add_to_gallery

 function add_to_gallery()
 {
     $gallery_peer = new GalleryPeer();
     $gallery = $gallery_peer->find_by_id(Params::get("id_gallery"));
     $collection_peer = new GalleryCollectionPeer();
     $gallery_collection = $collection_peer->find_by_id($gallery->id_gallery_collection);
     $full_folder_path = GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $gallery_collection->folder . "/" . $gallery->folder;
     if (Upload::isUploadSuccessful("file")) {
         $filename = Random::newHexString() . "_" . Upload::getRealFilename("file");
         $gallery_dir = new Dir($full_folder_path);
         $uploaded_img = Upload::saveTo("file", $gallery_dir, $filename);
         if (isset(Config::instance()->GALLERY_RESIZE_BY_WIDTH)) {
             image_w($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_WIDTH);
         } else {
             if (isset(Config::instance()->GALLERY_RESIZE_BY_HEIGHT)) {
                 image_h($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_HEIGHT);
             }
         }
         $peer = new GalleryImagePeer();
         $do = $peer->new_do();
         $peer->setupByParams($do);
         $do->image_name = $filename;
         $peer->save($do);
         return Redirect::success();
     } else {
         Flash::error(Upload::getUploadError("file"));
         return Redirect::failure();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:29,代码来源:GalleryImageController.class.php

示例2: create_collection

 function create_collection()
 {
     $peer = new GalleryCollectionPeer();
     $do = $peer->new_do();
     $peer->setupByParams($do);
     $do->folder = Random::newHexString();
     $d = new Dir(self::GALLERY_COLLECTION_ROOT_DIR . $do->folder);
     $d->touch();
     $peer->save($do);
     if (is_html()) {
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:15,代码来源:GalleryCollectionController.class.php

示例3: create_gallery

 function create_gallery()
 {
     $peer = new GalleryPeer();
     $gallery = $peer->new_do();
     $peer->setupByParams($gallery);
     $gallery->folder = Random::newHexString();
     $peer_collection = new GalleryCollectionPeer();
     $collection = $peer_collection->find_by_id($gallery->id_gallery_collection);
     $d = new Dir(GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $collection->folder . "/" . $gallery->folder);
     $d->touch();
     $peer->save($gallery);
     if (is_html()) {
         return Redirect::success();
     } else {
         return Result::ok();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:17,代码来源:GalleryController.class.php

示例4: newRandomSubdir

 function newRandomSubdir()
 {
     return $this->newSubdir(Random::newHexString());
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:4,代码来源:Dir.class.php


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