is php necessary to merge multiple PHP files, as little as require?

Source: Internet
Author: User
Tags apc
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.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.