请选择 进入手机版 | 继续访问电脑版

一元网络论坛

 找回密码
 立即注册
搜索
热搜: 活动 交友 discuz
查看: 4505|回复: 1

ThinkPHP,二、安装验证码插件报错,captch_img()函数不存在的...

[复制链接]

2万

主题

2万

帖子

6万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
66795
发表于 2020-11-22 15:14:44 | 显示全部楼层 |阅读模式

错误提示一般为:

Problem 1

    - topthink/think-captcha v3.0.3 requires topthink/framework ^6.0.0 -> satisf

iable by topthink/framework[6.0.x-dev, v6.0.0, v6.0.0-rc2, v6.0.0-rc3, v6.0.0-rc

4, v6.0.0-rc5, v6.0.1, v6.0.2, v6.0.3] but these conflict with your requirements

 or minimum-stability.

    - topthink/think-captcha v3.0.2 requires topthink/framework ^6.0.0 -> satisf

iable by topthink/framework[6.0.x-dev, v6.0.0, v6.0.0-rc2, v6.0.0-rc3, v6.0.0-rc

4, v6.0.0-rc5, v6.0.1, v6.0.2, v6.0.3] but these conflict with your requirements

 or minimum-stability.

    - topthink/think-captcha v3.0.1 requires topthink/framework ^6.0.0 -> satisf

iable by topthink/framework[6.0.x-dev, v6.0.0, v6.0.0-rc2, v6.0.0-rc3, v6.0.0-rc

4, v6.0.0-rc5, v6.0.1, v6.0.2, v6.0.3] but these conflict with your requirements

 or minimum-stability.

    - topthink/think-captcha v3.0.0 requires topthink/framework ^6.0.0 -> satisf

iable by topthink/framework[6.0.x-dev, v6.0.0, v6.0.0-rc2, v6.0.0-rc3, v6.0.0-rc

4, v6.0.0-rc5, v6.0.1, v6.0.2, v6.0.3] but these conflict with your requirements

 or minimum-stability.

    - Installation request for topthink/think-captcha ^3.0 -> satisfiable by top

think/think-captcha[v3.0.0, v3.0.1, v3.0.2, v3.0.3]. 

Installation failed, reverting ./composer.json to its original content.



解决方法:

Composer 安装 topthink/think-captcha 时报错 requires topthink/framework ^6.0.0 

当我们使用命令 composer require topthink/think-captcha下载验证码库时,默认下载最新版本,当前最新版本是3.0

3.0版本是为 ThinkPHP 6 准备的,所以我们需要下载 2.0 版本验证码库,2.0 版本的才是为 ThinkPHP5.1 准备的,

所以我们只要使用 composer 命令下载验证码库的时候指定版本号即可

composer require topthink/think-captcha=2.*

 

如果你使用的是 TP 5.0.* 的版本,直接运行上面的安装命令还是会报错,最直接的方法就是去 packagist 网站查看该代码包对应的 tp 版本,然后安装对应的版本即可

我当前的 TP 版本为 5.0.24,则可以安装 think-captcha=1.*即安装命令为:

composer require topthink/think-captcha=1.*

回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Archiver|手机版|小黑屋|一元网络论坛

GMT+8, 2024-10-8 22:55 , Processed in 0.098190 second(s), 19 queries .

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

快速回复 返回顶部 返回列表