laravel9 安装 maatwebsite/excel 报错Declaration of Maatwebsite\Excel

作者:Liaodeity - 2023年03月15日

解决

由于`psr/simple-cache`是默认3.0版本,导致maatwebsite/excel报错,安装2.0版本兼容

composer require psr/simple-cache:^2.0 maatwebsite/excel

异常错误

Maatwebsite没有兼容到Psr\SimpleCache\CacheInterface::get方法

Symfony\Component\ErrorHandler\Error\FatalError

  Declaration of Maatwebsite\Excel\Cache\MemoryCache::get(string $key, mixed $default = null): mixed must be compatible with Psr\SimpleCache\CacheInterface::get(
$key, $default = <default>)

  at D:\phpProject\vendor\maatwebsite\excel\src\Cache\MemoryCache.php:62
     58▕
     59▕     /**
     60▕      * {@inheritdoc}
     61▕      */
  ➜  62▕     public function get(string $key, mixed $default = null): mixed
     63▕     {
     64▕         if ($this->has($key)) {
     65▕             return $this->cache[$key];
     66▕         }


   Whoops\Exception\ErrorException


本文作者: Liaodeity

本文链接: https://www.jianbaizhan.com/article/747

版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 3.0 许可协议。转载请注明出处!


 请勿发布不友善或者负能量的内容。审查将对发布广告等违规信息进行处罚!