背景
项目要下载内容,那最好是用扩展了,常用的也就是maatwebsite/excel,但是今天安装的提示异常
错误如下:
Problem 1
- maatwebsite/excel[3.1.28, ..., 3.1.30] require phpoffice/phpspreadsheet 1.16.* -> satisfiable by phpoffice/phpspreadsheet[1.16.0].
- maatwebsite/excel[3.1.31, ..., 3.1.x-dev] require phpoffice/phpspreadsheet ^1.18 -> satisfiable by phpoffice/phpspreadsheet[1.18.0, ..., 1.29.0].
- maatwebsite/excel 3.1.27 requires phpoffice/phpspreadsheet ^1.16 -> satisfiable by phpoffice/phpspreadsheet[1.16.0, ..., 1.29.0].
- maatwebsite/excel 3.1.26 requires phpoffice/phpspreadsheet ^1.15 -> satisfiable by phpoffice/phpspreadsheet[1.15.0, ..., 1.29.0].
- maatwebsite/excel[3.1.22, ..., 3.1.25] require phpoffice/phpspreadsheet ^1.14 -> satisfiable by phpoffice/phpspreadsheet[1.14.0, ..., 1.29.0].
- phpoffice/phpspreadsheet[1.14.0, ..., 1.28.0] require maennchen/zipstream-php ^2.1 -> satisfiable by maennchen/zipstream-php[2.1.0, ..., v2.x-dev].
- phpoffice/phpspreadsheet 1.29.0 requires maennchen/zipstream-php ^2.1 || ^3.0 -> satisfiable by maennchen/zipstream-php[2.1.0, ..., v2.x-dev, 3.0.0-beta.1, ..., 3.1.0].
- maatwebsite/excel 3.1.0 requires illuminate/support ^5.5 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
- maatwebsite/excel[3.1.1, ..., 3.1.6] require illuminate/support 5.5.* || 5.6.* || 5.7.* -> found illuminate/support[v5.5.0, ..., 5.7.x-dev] but these were not loaded, likely because it conflicts with another require.
- maatwebsite/excel[3.1.7, ..., 3.1.15] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.* -> found illuminate/support[v5.5.0, ..., 5.8.x-dev] but these were not loaded, likely because it conflicts with another require.
- maatwebsite/excel[3.1.16, ..., 3.1.18] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.*|^6.0 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev] but these were not loaded, likely because it conflicts with another require.
- maatwebsite/excel[3.1.19, ..., 3.1.21] require illuminate/support 5.5.*|5.6.*|5.7.*|5.8.*|^6.0|^7.0 -> found illuminate/support[v5.5.0, ..., 5.8.x-dev, v6.0.0, ..., 6.x-dev, v7.0.0, ..., 7.x-dev] but these were not loaded, likely because it conflicts with another require.
- maennchen/zipstream-php[2.2.0, ..., v2.x-dev] require php ^8.0 -> your php version (7.4.14) does not satisfy that requirement.
- maennchen/zipstream-php[2.1.0, ..., 2.2.6] require psr/http-message ^1.0 -> found psr/http-message[1.0, 1.0.1, 1.1] but the package is fixed to 2.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- maennchen/zipstream-php[3.0.0-beta.1, ..., 3.1.0] require php-64bit ^8.1 -> your php-64bit version (7.4.14) does not satisfy that requirement.
- Root composer.json requires maatwebsite/excel ^3.1 -> satisfiable by maatwebsite/excel[3.1.0, ..., 3.1.x-dev].
Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
解决之路
看到报错,错误的发生是因为composer无法加载phpoffice/phpspreadsheet包。正常情况下,composer能够安装依赖项,现手动试试让它安装的时候自动安装依赖项,
composer require maatwebsite/excel --update-with-dependencies
然后就正常了哈文章来源:https://www.toymoban.com/news/detail-712466.html
导出excel时单元格内换行的问题,请点击这里查看文章来源地址https://www.toymoban.com/news/detail-712466.html
到了这里,关于如何安装maatwebsite/excel?的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!