简体   繁体   English

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

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

I have PHP application, that runs about 2-3 minutes before it return something to browser (some database processing stuff). 我有PHP应用程序,运行大约2-3分钟,然后它才向浏览器返回一些内容(一些数据库处理的东西)。

I want to know, if I can change php file with it while script is running. 我想知道,如果我可以在运行脚本时更改php文件。 I assume, there is a buffer in Apache/PHP. 我认为,Apache / PHP中有一个缓冲区。

I have situation like this: 我有这样的情况:

// 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

What will happen, when I replace "DatabaseController.php" file while script is running? 当我在脚本运行时替换“ DatabaseController.php”文件时会发生什么?

I tried to test it, and it looks like "job part" is still using old version of DatabaseController, when I replace. 我尝试对其进行测试,当我替换它时,看起来“作业部分”仍在使用旧版本的DatabaseController。

But... what will happen, when I replace "helpers.php" file? 但是...当我替换“ helpers.php”文件时会发生什么? It contains only functions, without classes that may be instantiated at the beginning of script. 它仅包含函数,而没有可以在脚本开始时实例化的类。

How this buffering works in general? 这种缓冲一般如何工作?

Its not really being buffered. 它并没有真正被缓冲。 You should read up on Compilers . 您应该阅读Compilers In summary, the code you write will first need to be compiled before it can be executed. 总之,在执行之前,首先需要编译您编写的代码。 Changes you make to the source after it has been compiled will not take effect until the next request when it will be recompiled again. 在对源进行编译之后,您对源所做的更改要等到下一个请求重新编译时才会生效。

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

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