很简单的几行代码,麻烦请高手替我讲解一下调用的思路。①new_1.php
<?php
function the1test(){
echo "the1test!";
the2test();
}
?>②new_2.php
<?php
function the2test(){
echo "the2test!";
}
?>③total.php
<?php
require_once("new_1.php");
require_once("new_2.php");
?>④testpage.php
<?php
require_once("total.php");
the1test();
?>接下来是我自己测试的结果。发现输出的结果是:the1test!the2test!我有一点疑问,为什么在new_1.php中能够直接调用new_2.php中的the2test()函数。难道是因为total.php的原因吗?这一点我始终没能理解到,谢谢!
<?php
function the1test(){
echo "the1test!";
the2test();
}
?>②new_2.php
<?php
function the2test(){
echo "the2test!";
}
?>③total.php
<?php
require_once("new_1.php");
require_once("new_2.php");
?>④testpage.php
<?php
require_once("total.php");
the1test();
?>接下来是我自己测试的结果。发现输出的结果是:the1test!the2test!我有一点疑问,为什么在new_1.php中能够直接调用new_2.php中的the2test()函数。难道是因为total.php的原因吗?这一点我始终没能理解到,谢谢!
等于都是在total.php中执行的,和new_1.php没有直接关系了,并不是在new_1.php中执行
testpage.php
等于<?php
// require_once('total.php');
function the1test(){
echo "the1test!";
the2test();
}function the2test(){
echo "the2test!";
}the1test();
?>