4
如何在無脂框架中的登錄表單中使用CAPTCHA插件?我之前從未使用CAPTCHA,所以我正在尋找某種教程來學習FatFree框架。在無脂框架中的驗證碼
任何人都可以指向一些資源或告訴我如何做到這一點?具體來說,我期望在模板中的表單中插入CAPTCHA,然後在提交表單時檢查正確性。
如何在無脂框架中的登錄表單中使用CAPTCHA插件?我之前從未使用CAPTCHA,所以我正在尋找某種教程來學習FatFree框架。在無脂框架中的驗證碼
任何人都可以指向一些資源或告訴我如何做到這一點?具體來說,我期望在模板中的表單中插入CAPTCHA,然後在提交表單時檢查正確性。
不含脂肪框架已經在建
<img src="/captcha" title="captcha image" alt="captcha"/>
<label for="code">Security Code</label>
<input type="text" name="code"/>
<p>{@message}</p>
然後在你的應用程序驗證碼,你應該有處理src屬性指定/驗證碼URL路徑:
F3::route('GET /captcha','securityCode');
function securityCode() {
Graphics::captcha(150,60,5);
}
輸入驗證腳本將如下所示: -
F3::input('code',
function($value) {
if (empty($value))
F3::set('message','Security code is required');
elseif ($value!=$_SESSION['captcha'])
F3::set('message','Invalid security code');
}
);
請參閱http://bcosca.github.com/fatfree/的完整文檔
有與無脂肪Captch一個已知的錯誤期待您正在使用最新版本,以解決它
You know about the bug with captcha()?
It's easy to fix!
Line number 81 in graphics.php with the error:
$ file = self:: $ global ['FONTS'].
Corrected version:
$ file = __DIR__ .'/../ fonts/'. self:: $ global [' FONTS '].
感謝您的回答。但是,我收到了一些錯誤,如filesize()[function.filesize]:stat失敗/var/www/cube.ttf。 在graphics.php中,沒有你要求修復的這樣的行。該行是$ file =&self :: vars ['FONTS']。我該怎麼辦? – Siddharth 2012-04-28 14:42:23
我真的明白了。我不得不設置F3 :: set('FONTS',/ path/to/fonts/folder')。 – Siddharth 2012-04-28 14:48:12
我使用Google Recaptcha,它與F3一起工作出色:p – Kavin 2016-10-09 06:56:14