【问题标题】:php artisan serve get cached or does not react while updating code in Laravel 5.5. After a restart, it works again each timephp artisan serve 在 Laravel 5.5 中更新代码时被缓存或不响应。重新启动后,它每次都会再次工作
【发布时间】:2022-02-02 11:54:42
【问题描述】:

我的 IDE 是 phpstorm 并在 WAMP 服务器上运行。在编码时,它不会显示预期的响应,总是返回先前请求的响应(在邮递员中)。每次,我都需要使用 CTRL+C 关闭“php artisan serve”,然后再次运行以获得预期的响应。

我尝试更改 IDE,更改端口,但它不起作用。当然,我厌倦了手动保存(CTRL+S),但问题仍然存在。
我还尝试了以下命令:

php artisan cache:clear
php artisan config:clear
php artisan route:clear
composer dump

但问题依然存在。

【问题讨论】:

  • 如果你有 wamp 那么你为什么要使用 php artisan serve ?使用php artisan serve --port 8080 在另一个端口上运行它。
  • 我尝试了除 8000 以外的其他端口,但问题仍然存在。

标签: php laravel caching


【解决方案1】:

问题可能是 composer 命令。请查看我在 Makefile 中的设置:

run:
    php artisan config:cache
    php artisan config:clear
    php artisan cache:clear
    composer.phar dump-autoload -o
    php artisan serve

它已经准备好使用 Laravel 的“干净构建”了。

【讨论】:

    【解决方案2】:

    您可以尝试使用不同的请求工具,例如在浏览器上执行 GET 吗? 或者只是创建一个新端点来测试它。这样可以确保更改正在保存。

    我建议您进行测试,看看是否:

    1. 问题出在你的邮递员身上(可能是缓存?);
    2. 问题是您的代码没有被保存;
    3. 问题出在您的本地服务器上(永久缓存?);

    我的建议是:尽量排除可能的原因,你应该得到答案。

    让我们尝试确认上述项目,如果它们没问题,我们会检查可能的其他项目。

    【讨论】:

      猜你喜欢
      • 2012-03-06
      • 2018-07-04
      • 2011-06-20
      • 2013-09-20
      • 2018-09-26
      • 1970-01-01
      • 2016-03-09
      • 2017-08-25
      • 2015-12-19
      相关资源
      最近更新 更多