本文整理汇总了PHP中Zend_Captcha_Word::generate方法的典型用法代码示例。如果您正苦于以下问题:PHP Zend_Captcha_Word::generate方法的具体用法?PHP Zend_Captcha_Word::generate怎么用?PHP Zend_Captcha_Word::generate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Zend_Captcha_Word
的用法示例。
在下文中一共展示了Zend_Captcha_Word::generate方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: generate
/**
* Generate captcha
*
* @return string
*/
public function generate()
{
if (!Mage::helper('uaudio_storage')->isEnabled()) {
return parent::generate();
}
$storageModel = Mage::getSingleton('core/file_storage')->getStorageModel();
$id = Zend_Captcha_Word::generate();
$tries = 5;
// If there's already such file, try creating a new ID
while ($tries-- && $storageModel->fileExists($this->getImgDir() . $id . $this->getSuffix())) {
$id = $this->_generateRandomId();
$this->_setId($id);
}
$this->_generateImage($id, $this->getWord());
if (mt_rand(1, $this->getGcFreq()) == 1) {
$this->_gc();
}
$imgFile = $this->getImgDir() . $id . $this->getSuffix();
$storageModel->moveFile($imgFile, $imgFile);
return $id;
}
示例2: generate
/**
* Generate captcha
*
* @return string captcha ID
*/
public function generate()
{
$id = parent::generate();
$tries = 5;
// If there's already such file, try creating a new ID
while ($tries-- && file_exists($this->getImgDir() . $id . $this->getSuffix())) {
$id = $this->_generateRandomId();
$this->_setId($id);
}
$this->_generateImage($id, $this->getWord());
if (mt_rand(1, $this->getGcFreq()) == 1) {
$this->_gc();
}
return $id;
}
示例3: generate
/**
* Generate new captcha
*
* @return string
*/
public function generate()
{
$this->_useNumbers = false;
return parent::generate();
}
示例4: generate
/**
* Generate captcha
*
* @return string captcha ID
*/
public function generate()
{
$id = parent::generate();
$this->_generateImage($id, $this->getWord());
if (mt_rand(0, $this->getGcFreq()) == 1) {
$this->_gc();
}
return $id;
}