thinkphp二维码的生成以及composer问题

本文记录了在ThinkPHP中生成二维码时遇到的问题,以及在解决过程中碰到的Composer扩展安装错误。作者在CMD中尝试安装php_fileinfo.dll扩展,但遇到了未开启的错误。尝试多种解决方案,如修改composer.json、调整镜像源,最终发现可能是由于Composer版本与PHP版本不匹配导致。升级Composer后,问题得到解决,成功安装了所需的二维码插件。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

今天写一个二维码生成
这个是正确的,但是重要是下面
https://www.kancloud.cn/phper123/tools/289789

我在cmd里面安装的

Using version ^1.0 for aferrandini/phpqrcode
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpoffice/phpspreadsheet 1.6.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - phpoffice/phpspreadsheet 1.6.0 requires ext-fileinfo * -> the requested PHP extension fileinfo is missing from your system.
    - Installation request for phpoffice/phpspreadsheet (installed at 1.6.0) -> satisfiable by phpoffice/phpspreadsheet[1.6.0].

  To enable extensions, verify that they are enabled in your .ini files:
    - E:\phpstudy\PHPTutorial\php\php-7.2.1-nts\php.ini
  You can also run `php --ini` inside terminal to see which files are used by PHP in CLI mode.

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

这个意思是phpini中的 extension=php_fileinfo.dll没有开启,开启重启,然后还报哪个错,说我没有开启
找了找要安装这个插件

composer require aferrandini/phpqrcode

这个,将这个添加进去
随即出现错误

  [Composer\Downloader\TransportException]
  The "https://packagist.phpcomposer.com/p/provider-2018-07%24420066adc83f62f5e996200c232bbc918588adcf5024a90bac16c19
  8b508e734.json" file could not be downloaded (HTTP/1.1 404 Not Found)


require [--dev] [--prefer-source] [--prefer-dist] [--no-progress] [--no-suggest] [--no-update] [--no-scripts] [--update-no-dev] [--update-with-dependencies] [--update-with-all-dependencies] [--ignore-platform-reqs] [--prefer-stable] [--prefer-lowest] [--sort-packages] [-o|--optimize-autoloader] [-a|--classmap-authoritative] [--apcu-autoloader] [--] [<packages>]...

重试了很多次都没有成功
有说让在composer.json里面添加这个的

"packagist": {
        "type": "composer",
        "url": "https://packagist.laravel-china.org"
    },

有说让尝试镜像问题,取消镜像

composer config -g repos.packagist composer https://php.cnpkg.org
//然后把默认的 secure-http 改成false;运行代码;
composer config -g secure-http false

弄了半天弄不明白,本人对英文不够了解,看了半天,还是第一个的那个报错,偶尔翻起,看到了版本问题,是不是composer的版本,我用的php版本比较高,就去试了试

composer install --ignore-platform-reqs
或者
composer update --ignore-platform-reqs

然后就开始下载了

Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
  - Installing phpoffice/phpexcel (1.8.2): Downloading (100%)
  - Installing aferrandini/phpqrcode (1.0.1): Downloading (100%)
Package phpoffice/phpexcel is abandoned, you should avoid using it. Use phpoffice/phpspreadsheet instead.
Package aferrandini/phpqrcode is abandoned, you should avoid using it. Use endroid/qr-code instead.
Writing lock file
Generating autoload files

默认也将我要安装的二维码插件安好了,完后

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值