#file:include1.php include 'include2.php'; //@todo something
复制代码
#file:include2.php //@todo something
复制代码
#file:script1.php include 'include2.php'; //@todo something
复制代码
#file:script2.php include 'include1.php'; include 'script1.php' //@todo something
复制代码
当履行script1.php时, include ‘include2.php’; 这行代码被履行了一次。而履行script2.php时,这行代码被履行了两次。
这里只是一个复杂的例子,在实践的项目中,include2.php被include的次数能够更多。如许重复的include,是不是会影响功能呢?为此我写了个剧本来测试。
#file:SimpleClass.php class SimpleClass { public function __construct() { echo get_time() . "\r\n"; } }