예제 #1
0
파일: ImageService.php 프로젝트: jay45/porn
 public static function getAvailableKey()
 {
     while (true) {
         $length = rand(4, 6);
         $key = MyStringGenerator::createRandomString($length);
         $img = self::getImageByKey($key);
         if ($img == null) {
             return $key;
         }
     }
 }
예제 #2
0
 private function getAvailableKey()
 {
     while (true) {
         $length = rand(4, 6);
         $key = MyStringGenerator::createRandomString($length);
         $img = $this->findOneBy(array('key' => $key));
         if ($img == null) {
             return $key;
         }
     }
 }