本文整理匯總了PHP中Inflector::quickRandom方法的典型用法代碼示例。如果您正苦於以下問題:PHP Inflector::quickRandom方法的具體用法?PHP Inflector::quickRandom怎麽用?PHP Inflector::quickRandom使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Inflector
的用法示例。
在下文中一共展示了Inflector::quickRandom方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: makeKey
public static function makeKey($type)
{
$dir = static::checkDir($type);
$key = Inflector::quickRandom(9);
$check = STORAGE_PATH . DS . 'project' . DS . $dir . DS . $key . '.' . Inflector::lower($type);
if (File::exists($check)) {
return static::makeKey($type);
}
return $key;
}
示例2: _makeKey
private static function _makeKey($keyLength = 9)
{
$key = Inflector::quickRandom($keyLength);
if (!Arrays::in($key, static::$keys)) {
static::$keys[] = $key;
return $key;
} else {
return static::_makeKey($keyLength);
}
}
示例3: makeKey
public static function makeKey()
{
$key = Inflector::quickRandom(9);
$check = STORAGE_PATH . DS . 'articles' . DS . $key . '.message';
if (File::exists($check)) {
return static::makeKey();
}
return $key;
}
示例4: makeView
public static function makeView($campaign, $user)
{
$dirStatsViews = STORAGE_PATH . DS . 'newsletters' . DS . 'stats' . DS . 'views';
$dirCampaign = $dirStatsViews . DS . $campaign->getId();
if (!is_dir($dirCampaign)) {
mkdir($dirCampaign, 0777);
}
$dirUser = $dirCampaign . DS . $user->getId();
if (!is_dir($dirUser)) {
mkdir($dirUser, 0777);
}
$count = glob($dirUser . DS . '*.count', GLOB_NOSORT);
if (!count($count)) {
$key = Inflector::quickRandom(9);
$newCount = $dirUser . DS . $key . '.count';
$initialize = new viewCount();
$initialize->setId($key);
$initialize->setCampaign($campaign->getId());
$initialize->setUser($user->getId());
$initialize->setCount(0);
$initialize->setDates(array());
$serialize = serialize($initialize);
File::delete($newCount);
File::put($newCount, $serialize);
return $initialize;
} else {
return static::getObject(current($count));
}
}