我已經嘗試為 github 和通過 Composer 兩種方式安裝 phpspreadsheet 包,但我無法在 composer 中安裝我正在嘗試這些命令:- composer require phpoffice/phpspreadsheet 但它不起作用它基本上顯示了這些型別的錯誤: - [InvalidArgumentException] 軟體包 phpoffice/phpspreadsheet 的要求與您的 PHP 版本、PHP 擴展和 Composer 版本不兼容: - phpoffice/phpspreadsheet 1.19.0 需要 ext-gd * 但它不存在。當我直接嘗試 github 代碼時,其檔案的方式不正確,因為需要 git hub 鏈接:- https://github.com/PHPOffice/PhpSpreadsheet
uj5u.com熱心網友回復:
phpoffice/phpspreadsheet v1.19.0 需要 php: ^7.3 || ^8.0
通過運行此命令檢查您安裝的 PHP 版本
php -v。確保它大于或等于7.3。其次,確保檔案中的 PHP 版本宣告
composer.json也大于或等于7.3. IE:
"php": "^7.3 || ^8.0",
- 如果您的應用程式具有與 PHP 版本不兼容的依賴項
>= 7.3,您可能需要安裝較低版本的phpspreadsheet iecomposer require phpoffice/phpspreadsheet "^1.8.0"(需要 php: "^5.6|^7.0")而不是調整檔案中的 PHP 版本composer.json。
- 此外,如果您使用的是xampp,請確保在嘗試安裝庫之前在檔案C:\xampp\php\php.ini 中啟用了這些擴展。
extension=mbstring
extension=fileinfo
extension=gd
安裝
composer require phpoffice/phpspreadsheet "^1.19.0"
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/366010.html
