我有PHP应用程序,在它返回一些东西给浏览器(一些数据库处理的东西)之前运行大约2-3分钟。
我想知道,在脚本运行时,我是否可以用它来更改php文件。我想,Apache/PHP中有一个缓冲区。
我有这样的情况:
// This is index.php
include "DatabaseController.php"; // class inside, I create instance at start
include "ImagesController.php"; // class inside, I create instance at start
include "helpers.php"; // there are just functions, no classes
$db = new Database();
$img = new Images();
// for loop doing job here (2-3 minutes)
// end当脚本运行时,我替换"DatabaseController.php“文件会发生什么?
我试着测试它,当我替换它时,它看起来“作业部分”仍然在使用旧版本的DatabaseController。
但是..。当我替换"helpers.php“文件时会发生什么?它只包含函数,没有在脚本开始时实例化的类。
一般情况下,这种缓冲是如何工作的?
发布于 2013-08-01 23:29:14
这并不是真正的缓冲。你应该读一读Compilers。总之,您编写的代码在执行之前首先需要编译。在源代码编译后对其所做的更改将在下一个请求再次被重新编译之前生效。
https://stackoverflow.com/questions/18006182
复制相似问题