yii架構中驗證碼為什麼總是驗證錯誤

來源:互聯網
上載者:User
我的view頁面
我的controller
那個formmodel頁面
試了很多種寫法 反正驗證嗎寫對的 他就是給我說驗證碼錯誤 實在不知道怎麼辦了 求幫忙啊啊~~~


回複討論(解決方案)

哈哈 我自己解決了 原是這樣啊!!我在架構驗證碼那個類裡加了一行後才不對的public function run()
{
//$this->fixedVerifyCode=substr(mt_rand(1,10000),0,4);//最佳化驗證碼
if(isset($_GET[self::REFRESH_GET_VAR])) // AJAX request for regenerating code
{
$code=$this->getVerifyCode(true);
echo CJSON::encode(array(
'hash1'=>$this->generateValidationHash($code),
'hash2'=>$this->generateValidationHash(strtolower($code)),
// we add a random 'v' parameter so that FireFox can refresh the image
// when src attribute of image tag is changed
'url'=>$this->getController()->createUrl($this->getId(),array('v' => uniqid())),
));
}
else
$this->renderImage($this->getVerifyCode());
Yii::app()->end();
}

就加了那一行最佳化驗證碼後就不對了 注釋掉後 就對了

  • 聯繫我們

    該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

    如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.