Laravel中使用验证码

在Laravel中如果需要验证码,可以使用mews/captcha库来实现,过程如下 :

安装:

composer require "mews/captcha"

发布配置文件:

php artisan vendor:publish

前端引用:

<img src="{{captcha_src()}}" style="cursor: pointer" onclick="this.src='{{captcha_src()}}'+Math.random()">

注意,项目路径不能有中文,否则会报错:ErrorException: imagettfbbox(): Could not find/open font

简单吧,这就是生态强大的好处。

评论

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注