TP5.0使用composer安装验证码类遇到的问题

编程入门 行业动态 更新时间:2024-10-10 01:19:44

TP5.0使用composer安装<a href=https://www.elefans.com/category/jswz/34/1771040.html style=验证码类遇到的问题"/>

TP5.0使用composer安装验证码类遇到的问题

使用TP5.0框架的验证码时需要先安装验证码类,但是在安装中遇到了各种各样的问题,搞了半天终于安装成功了,下面将问题汇总一下,

  首先要安装composer,大部分“composer require topthink/think-captcha”命令无法运行或者提示不是内部文件或可执行命令,都是因为没有安装composer,或安装不成功。直接百度搜composer即可,有链接,百度经验里也有教程,不在这里详细介绍了。

composer安装成功后,在你的项目主目录地址栏里输入cmd,然后输入composer require topthink/think-captcha来下载安装captcha,当然此时有很大概率会报错,

来说一下我遇到的两个问题吧,

 

第一:网络问题,输入“”composer require topthink/think-captcha“”窗口一直无响应,此时需要使用以下命令修改composer配置文件,使用国内镜像。原因你懂的。

composer config -g repo.packagist composer

第二:版本问题:此时有大概率会引版本不符而报错,错误提示代码如下:

Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - topthink/think-captcha v2.0.1 requires topthink/framework 5.1.x-dev -> satisfiable by topthink/framework[5.1.x-dev] but these conflict with your requirements or minimum-stability.
    - topthink/think-captcha v2.0 requires topthink/framework 5.1.x-dev -> satisfiable by topthink/framework[5.1.x-dev] but these conflict with your requirements or minimum-stability.
    - Installation request for topthink/think-captcha ^2.0 -> satisfiable by topthink/think-captcha[v2.0, v2.0.1, v2.0.2].
    - Conclusion: don't install topthink/framework v5.1.35
    - Conclusion: don't install topthink/framework v5.1.34
    - Conclusion: don't install topthink/framework v5.1.33
    - Conclusion: don't install topthink/framework v5.1.32
    - Conclusion: don't install topthink/framework v5.1.31
    - Conclusion: don't install topthink/framework v5.1.30
    - Conclusion: don't install topthink/framework v5.1.29
    - Conclusion: don't install topthink/framework v5.1.28
    - Conclusion: don't install topthink/framework v5.1.27
    - Conclusion: don't install topthink/framework v5.1.26
    - Conclusion: don't install topthink/framework v5.1.25
    - Conclusion: don't install topthink/framework v5.1.24
    - Conclusion: don't install topthink/framework v5.1.23
    - Conclusion: don't install topthink/framework v5.1.22
    - Conclusion: don't install topthink/framework v5.1.21
    - Conclusion: don't install topthink/framework v5.1.20
    - Conclusion: don't install topthink/framework v5.1.19
    - Conclusion: don't install topthink/framework v5.1.18
    - Conclusion: don't install topthink/framework v5.1.17
    - Conclusion: don't install topthink/framework v5.1.16
    - Conclusion: don't install topthink/framework v5.1.15
    - Conclusion: don't install topthink/framework v5.1.14
    - Conclusion: don't install topthink/framework v5.1.13
    - Conclusion: don't install topthink/framework v5.1.12
    - Conclusion: don't install topthink/framework v5.1.11
    - Conclusion: don't install topthink/framework v5.1.10
    - Conclusion: don't install topthink/framework v5.1.9
    - Conclusion: don't install topthink/framework v5.1.8
    - Conclusion: don't install topthink/framework v5.1.7
    - Conclusion: don't install topthink/framework v5.1.6
    - Conclusion: don't install topthink/framework v5.1.5
    - Conclusion: don't install topthink/framework v5.1.4
    - Conclusion: don't install topthink/framework v5.1.3
    - Conclusion: don't install topthink/framework v5.1.2
    - Can only install one of: topthink/framework[v5.1.0, v5.0.3].
    - Can only install one of: topthink/framework[v5.1.0, v5.0.3].
    - topthink/think-captcha v2.0.2 requires topthink/framework 5.1.* -> satisfiable by topthink/framework[v5.1.0, v5.1.1, v5.1.10, v5.1.11, v5.1.12, v5.1.13, v5.1.14, v5.1.15, v5.1.16, v5.1.17, v5.1.18, v5.1.19, v5.1.2, v5.1.20, v5.1.21, v5.1.22, v5.1.23, v5.1.24, v5.1.25, v5.1.26, v5.1.27, v5.1.28, v5.1.29, v5.1.3, v5.1.30, v5.1.31, v5.1.32, v5.1.33, v5.1.34, v5.1.35, v5.1.4, v5.1.5, v5.1.6, v5.1.7, v5.1.8, v5.1.9].
    - Conclusion: don't install topthink/framework v5.1.1
    - Installation request for topthink/framework (locked at v5.0.3, required as ^5.0) -> satisfiable by topthink/framework[v5.0.3].


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

 

此时我们需要同步一下各自版本,建议使用命令:composer update --ignore-platform-reqs

执行成功之后,就可以使用命令:composer require topthink/think-captcha 来安装验证码类了

 

转载于:.html

更多推荐

TP5.0使用composer安装验证码类遇到的问题

本文发布于:2024-03-09 08:11:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1724424.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:验证码   composer

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!