such as template files, there are header.php,footer.php,widget.php and so on, these are require to main.php, it is necessary to merge these files into a whole file it? What if XCache or APC or Accelerater are loaded?
Thank you for the answer, and to add, I mean is it necessary to generate the final template cache file like thinkphp? If necessary, is there a class that will generate the final PHP file in the require sequence that multiple PHP files are detected in? Thank you.
Reply content:
such as template files, there are header.php,footer.php,widget.php and so on, these are require to main.php, it is necessary to merge these files into a whole file it? What if XCache or APC or Accelerater are loaded?
Thank you for the answer, and to add, I mean is it necessary to generate the final template cache file like thinkphp? If necessary, is there a class that will generate the final PHP file in the require sequence that multiple PHP files are detected in? Thank you.
Multiple files help to organize the code structure and improve the readability and maintainability of the code.
Compared to the overhead of several IO, it is clear that readability and maintainability are much more important in a real-world production environment.
Business code level is not recommended, nor necessary.
The view template code is automatically merged by the modern framework in the production environment to generate the cache, and there is no need to manually merge.
The data cache at the Memcache/redis level is not covered by this issue.
If you do a project like this, this project is not going to work at all.
The production environment uses tools such as APC to load code directly into memory
This year, with Apc/opcache, you don't have to think about require.