當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。