繁体   English   中英

PHP脚本如何在服务器上缓冲(?)?

[英]How PHP scripts bufferred (?) on server?

我有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”文件时会发生什么? 它仅包含函数,而没有可以在脚本开始时实例化的类。

这种缓冲一般如何工作?

它并没有真正被缓冲。 您应该阅读Compilers 总之,在执行之前,首先需要编译您编写的代码。 在对源进行编译之后,您对源所做的更改要等到下一个请求重新编译时才会生效。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM