【问题标题】:Laravel: The use statement with non-compound name 'Cache' has no effect [duplicate]Laravel:非复合名称“缓存”的使用语句无效[重复]
【发布时间】:2017-05-17 10:11:04
【问题描述】:

我有 centos7 php56 laravel 5memcached 但是当在 routes.php 中尝试 use Cache 时,我得到:

ErrorException in routes.php line 3:
The use statement with non-compound name 'Cache' has no effect

路由器.php

<?php

use Cache;
...

【问题讨论】:

标签: php laravel caching


【解决方案1】:

只需从您的 routes.php 中删除 use Cache;。那里不需要它,因为文件本身与特定的命名空间无关。删除它后,您将不会再看到该警告。

【讨论】:

    【解决方案2】:

    那是因为您已经在全局命名空间中。因此,当您执行 use Cache; 之类的操作时,您是在说“当我说 Cache 时,我的意思是 \Cache”。因为您已经 are 在全局命名空间中,所以该语句无效。这就是警告的内容。

    【讨论】:

      猜你喜欢
      • 2014-07-07
      • 2014-12-19
      • 1970-01-01
      • 1970-01-01
      • 2012-03-08
      • 2020-12-13
      • 2015-05-14
      • 1970-01-01
      相关资源
      最近更新 更多