本文整理匯總了PHP中Securimage::_captchaId方法的典型用法代碼示例。如果您正苦於以下問題:PHP Securimage::_captchaId方法的具體用法?PHP Securimage::_captchaId怎麽用?PHP Securimage::_captchaId使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Securimage
的用法示例。
在下文中一共展示了Securimage::_captchaId方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: getCaptchaId
/**
* Generate a new captcha ID or retrieve the current ID
*
* @param $new bool If true, generates a new challenge and returns and ID
* @param $options array Additional options to be passed to Securimage.
* Must include database options if not set directly in securimage.php
*
* @return null|string Returns null if no captcha id set and new was false, or string captcha ID
*/
public static function getCaptchaId($new = true, array $options = array())
{
if (is_null($new) || (bool) $new == true) {
$id = sha1(uniqid($_SERVER['REMOTE_ADDR'], true));
$opts = array('no_session' => true, 'use_database' => true);
if (sizeof($options) > 0) {
$opts = array_merge($options, $opts);
}
$si = new self($opts);
Securimage::$_captchaId = $id;
$si->createCode();
return $id;
} else {
return Securimage::$_captchaId;
}
}