【问题标题】:Not enough arguments (missing: "key"). in laravel php artisan cache:forget没有足够的参数(缺少:“key”)。在 laravel php artisan 缓存中:忘记
【发布时间】:2018-08-12 17:53:24
【问题描述】:

当我尝试从 laravel 5.5 项目中删除我的所有缓存文件时,我在运行此命令时遇到了一些错误

php 工匠缓存:忘记

参数不足(缺少:“key”)。

【问题讨论】:

  • 你有没有执行这个命令php artisan key:generate

标签: php laravel laravel-cache


【解决方案1】:

要删除整个缓存,您可以使用Cache::flush(); 要从缓存中删除密钥,您可以通过编程方式使用Cache::forget('key')

你也可以使用artisan console

php artisan cache:forget key="yourkey"

希望对你有帮助

【讨论】:

    【解决方案2】:

    使用命令php artisan cache:forget -h 查看参数和选项列表。

    这是缓存的列表参数和选项:forget command larvel 5.4

    Arguments:
      key                   The key to remove
      store                 The store to remove the key from
    
    Options:
      -h, --help            Display this help message
      -q, --quiet           Do not output any message
      -V, --version         Display this application version
          --ansi            Force ANSI output
          --no-ansi         Disable ANSI output
      -n, --no-interaction  Do not ask any interactive question
          --env[=ENV]       The environment the command should run under
      -v|vv|vvv, --verbose  Increase the verbosity of messages: 1 for normal output, 2 for more verbose output and 3 for debug
    

    如果要删除所有缓存文件,可以运行此命令

    php artisan cache:clear
    php artisan config:cache
    

    并查看更多工匠命令

    php artisan list
    

    【讨论】:

      【解决方案3】:

      你可以使用

      php artisan cache:clear
      

      使用此命令生成密钥后:

      php artisan key:generate
      

      【讨论】:

        猜你喜欢
        • 2020-03-03
        • 2015-05-28
        • 1970-01-01
        • 1970-01-01
        • 2019-11-03
        • 2020-06-04
        • 2017-03-29
        • 1970-01-01
        • 2011-02-09
        相关资源
        最近更新 更多