尝试从名称空间“ Spatie \ Browsershot”加载类“ Browsershot”。您是否忘记了另一个名称空间的“使用”语句?

时间:2019-10-16 10:12:20

标签: php namespaces symfony-3.4 spatie browsershot

我正在使用symfony3.4。3.4不支持最新的spatie/browsershot。因此,我使用命令composer require spatie/browsershot:3.26.0安装了旧版本。成功安装。供应商文件夹中的Browsershot文件如下。

    <?php

    namespace Spatie\Browsershot;

    use Spatie\Image\Image;
    use Spatie\Image\Manipulations;
    use Symfony\Component\Process\Process;
    use Spatie\TemporaryDirectory\TemporaryDirectory;
    use Spatie\Browsershot\Exceptions\ElementNotFound;
    use Spatie\Browsershot\Exceptions\CouldNotTakeBrowsershot;
    use Symfony\Component\Process\Exception\ProcessFailedException;

    /** @mixin \Spatie\Image\Manipulations */
    class Browsershot
    {
        protected $nodeBinary = null;
        protected $npmBinary = null;
        protected $nodeModulePath = null;
        protected $includePath = '$PATH:/usr/local/bin';
        protected $binPath = null;
....

在我的控制器上,我将其包括为

use Spatie\Browsershot\Browsershot;

当我在

函数上使用类时
$Browsershot=new Browsershot();

错误显示为

  

试图从名称空间加载类“ Browsershot”   “ Spatie \ Browsershot”。您是否忘记了另一个的“使用”声明   命名空间?

我在做什么错了?

0 个答案:

没有答案