For example, the template file contains a header. php, footer. php, widget. php and so on. These are all require to main. php, is it necessary to merge all these files into a whole file? What if xcacheorAPCoraccelerater is loaded? Thank you for your answers... for example, the template file contains a header. php, footer. php, widget. php and so on. These are all require to main. php, is it necessary to merge all these files into a whole file? What if xcache or APC or accelerater is loaded?
Thank you for your answers. To add this question, do I mean it is necessary to generate the final template cache file like thinkphp? If necessary, is there a class that generates the final PHP file based on the detected require sequence for multiple PHP files? Thanks
Reply content:
For example, the template file contains a header. php, footer. php, widget. php and so on. These are all require to main. php, is it necessary to merge all these files into a whole file? What if xcache or APC or accelerater is loaded?
Thank you for your answers. To add this question, do I mean it is necessary to generate the final template cache file like thinkphp? If necessary, is there a class that generates the final PHP file based on the detected require sequence for multiple PHP files? Thanks
Multiple files help to properly organize the code structure and improve the readability and maintainability of the Code.
Compared with several IO overhead, it is obvious that readability and maintainability are much more important in the actual production environment.
The Business Code layer is not recommended or necessary.
The view template code is automatically merged by the modern framework to generate a cache in the production environment, and there is no need to manually merge the view template code.
Data caching at the Memcache/Redis level is not discussed in this issue.
If you want to solve such problems in the project, this project cannot be implemented at all.
The production environment uses tools such as APC to directly Load Code into memory.
Now we have apc/opcache, so you don't have to worry about require.