简体   繁体   English

有没有更快的方法来包含 PHP 文件?

[英]Is there a faster way to include PHP files?

I have the following code when I want to include some code from another PHP file:当我想包含另一个 PHP 文件中的一些代码时,我有以下代码:

$domain = 'www.example.com';
require_once $domain.'/footer.php');

I wonder though if this is slower than it could be, because surely this then has to go through a DNS to find the page?我想知道这是否比它可能的速度慢,因为这肯定必须通过 DNS 才能找到页面?

Is there a quicker way to do this?有没有更快的方法来做到这一点? Maybe I should set my IP as $domain?也许我应该将我的 IP 设置为 $domain? Or maybe there is some PHP snippet that will detect it for me?或者也许有一些 PHP 片段可以为我检测到它?

I also pay for DNS hits, so there's that too...我还为 DNS 命中付费,所以也是如此...

No thought You can include file via autoloader but there is no other way to include files than想到您可以通过自动加载器包含文件,但没有其他方法可以包含文件

Require and include in php and both are fast, even if you use temples it would be same.要求并包含在 php 中,两者都很快,即使您使用寺庙,它也是一样的。

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

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