标签: phpoffice-phpspreadsheet

Laravel 8 中损坏的 composer.json 文件

当我试图maatwebsite/excel从我的项目中删除包时,我严重损坏了一些东西。问题是我无法跟踪我所做的更改。在我maatwebsite/excel从 composer.json 中删除之前,我phpoffice/phpspreadsheet可能从 composer.json 中删除了。但我记不清了。因为当我用 git 查看旧版本时,我再也找不到这个条目了。每次我调用 Composer 时,它现在都会给出一条类似以下内容的大量错误消息。

在 ArrayLoader.php 第 44 行:Unknown package has no name defined ([{"name":"asm89/stack-cors","version":"v2.0.1","version_normalized":"2.0.1.0","source ":{"type":"git","url":"https://github.com/asm89/stack-cors.git","re​​ference":"23f469e81c65e2fb7fc7bce371fbdc363fe32adf"},"dist":{"type" :"zip","url":"https://api.github.com/repos/asm89/stack-cors/zipball/23f469e81c65e2fb7fc7bce371fbdc363fe32adf","re​​ference":"23f469e81c65e2fb37f","23f469e81c65e2fb37f"">3fesumshad7f", "require":{"php":"^7.0","symfony/http->foundation":"~2.7|~3.0|~4.0|~5.0","symfony/http-kernel":"~2.7|~ 3.0|~4.0|~5.0"},"require-dev":{"phpunit/phpunit":"^6|^7|^8|^9","squizlabs/php_codesniffer":"^3.5"}," time":"2020-05-31T07:17:05+00:00","type":"library","extra":{"branch-alias":{"dev-master": "2.0-dev" }},"installation-source":"dist","autoload":{"psr-4":{"Asm89\Stack\":"src/"}},"notification-url":"https:// packagist.org/downloads/","license":["MIT"],"authors":[{"name":"Alexander","email":"iam.asm89@gmail.com"}],"description ":"跨源资源共享库和栈中间件","主页":"https://github.com/asm89/stack-cors","keywords":["cors","stack"],"install-path":"../asm89/stack-cors"},{"name":"bacon/bacon-qr-code","version" :"2.0.2","version_normalized":"2.0.2.0","source":{"type":"git","url":"https://github.com/Bacon/BaconQrCode.git", "reference":"add6d9ff97336b62f95a3b94f75cea4e085465b2"},"dist":{"type":"zip","url":"https://api.github.com/repos/Bacon/BaconQrCode/zipball/add6d9ff97336bsource":{"type":"git","url":"https://github.com/Bacon/BaconQrCode.git","re​​ference":"add6d9ff97336b62f95a3b94f75cea4e085465b2"},"dist":{"type": "zip","url":"https://api.github.com/repos/Bacon/BaconQrCode/zipball/add6d9ff97336bsource":{"type":"git","url":"https://github.com/Bacon/BaconQrCode.git","re​​ference":"add6d9ff97336b62f95a3b94f75cea4e085465b2"},"dist":{"type": "zip","url":"https://api.github.com/repos/Bacon/BaconQrCode/zipball/add6d9ff97336b

错误消息的大小为 165K。也许,有人对我如何解决这个问题有建议?

composer-php maatwebsite-excel laravel-8 phpoffice-phpspreadsheet

6
推荐指数
1
解决办法
2984
查看次数

我们发现“Spreadsheet.xlsx”中的某些内容存在问题。您希望我们尽力恢复吗?

我有以下基本 PHP 项目(只有一个文件加上 Composer 配置):

作曲家.json

{
    "config": {
        "optimize-autoloader": true,
        "platform": {
            "php": "7.4.9"
        }
    },
    "require": {
        "phpoffice/phpspreadsheet": "1.10.0"
    }
}
Run Code Online (Sandbox Code Playgroud)

索引.php

<?php

require_once __DIR__ . '/vendor/autoload.php';
function errorHandler() {
    return true;
}
set_error_handler('errorHandler');

$sheets = array(
    array('index' => 0, 'title' => 'Graph'),
    array('index' => 1, 'title' => 'Data'),
);

$phpSpreadsheetObject = new \PhpOffice\PhpSpreadsheet\Spreadsheet();

foreach ($sheets as $sheet) {
    $name = $sheet['title'];
    if ($sheet['index']) {
        $worksheet[$name] = $phpSpreadsheetObject->createSheet($sheet['index']);
    } else {
        $worksheet[$name] = $phpSpreadsheetObject->getActiveSheet();
    }
    $phpSpreadsheetObject->setActiveSheetIndex($sheet['index']);
    $worksheet[$name]->setTitle($sheet['title']);
} …
Run Code Online (Sandbox Code Playgroud)

php excel phpoffice phpoffice-phpspreadsheet

5
推荐指数
1
解决办法
1932
查看次数

使用 laravel 9 安装 maatwebsite/excel 但出现 phpoffice/phpspreadsheet 错误

使用 Laravel 9 安装 maatwebsite/excel 但出现 phpoffice 和 PHP 版本问题。我正在使用 PHP 8.1,我降级到 PHP 8.0 但仍然无法工作。即使我从 php.ini 文件启用 gd 扩展。

我正在使用官方网站提供的以下命令安装 maatwebsite

composer require maatwebsite/excel
Run Code Online (Sandbox Code Playgroud)

在此输入图像描述

laravel composer-php maatwebsite-excel phpoffice-phpspreadsheet

3
推荐指数
2
解决办法
1万
查看次数