Home  >  Article  >  PHP Framework  >  Think-Swoole tutorial hot update

Think-Swoole tutorial hot update

藏色散人
藏色散人forward
2020-09-16 09:25:562864browse

I recently started to contact and develop Swoole. When I first came into contact with it, I was really confused and I searched for a lot of information to understand it. Recently, I have been working on some advanced functions of Swoole. I have summarized some experience of integrating Swoole with the Thinkphp6.0 framework based on actual projects, and compiled and shared it with some information on the Internet.

Recommended tutorials: "thinkphp" "swoole tutorial"

Since the PHP file is resident in the memory during the running of the Swoole service, so It can avoid repeatedly reading the disk and repeatedly interpreting and compiling PHP in order to achieve the highest performance. Therefore, after changing the business code, you must manually reload or restart it to take effect.

The think-swoole extension provides a hot update function. It will automatically reload after detecting that the files in the relevant directories have been updated. This eliminates the need for manual reload operations and facilitates development and debugging.

If your application has debug mode enabled, hot update is enabled by default. In principle, it is not recommended to turn on file monitoring in deployment mode. On the one hand, there will be performance losses, and on the other hand, any modifications made to the files need to be confirmed before update deployment can be carried out.

ThinkPHP 6 has a .example.env file by default in the root directory of the application. Copy this file and rename it to .env. When this special .env environment variable file is defined and APP_DEBUG = true is set in it, hot update will be enabled by default. In addition, you can also directly set enable in the hot_update configuration in /app/config/swoole.php to true.

.env

Think-Swoole tutorial hot update

config/swoole.php

Think-Swoole tutorial hot update

The above is the detailed content of Think-Swoole tutorial hot update. For more information, please follow other related articles on the PHP Chinese website!

Statement:
This article is reproduced at:阿dai哥. If there is any infringement, please contact admin@php.cn delete