php 弃用警告仅在文件更改时出现

php deprecated warning is only if file changed

我故意设置 error_reporting,所以我在开发时看到 E_DEPRECATED 警告。

现在在某些地方不显示这些警告:我成功收到警告

Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; ... has a deprecated constructor

但前提是文件时间改变了。如果我重新加载页面,警告就会消失。如果我在文件系统上再次触摸该文件,然后重新加载页面,它就在那里。

我知道如何修复错误,但是如何 我要关闭这个 "feature" 吗?

我必须怎么做才能收到警告总是

只是不要在您的 docker 映像中安装 opcache,因此请编辑此行:

  docker-php-ext-install -j$(nproc) intl mysqli soap gd zip opcache && \

只是

  docker-php-ext-install -j$(nproc) intl mysqli soap gd zip && \

并重建图像。

这肯定有效,但您也可以编辑 php.ini 并在那里禁用 opcache