Rumah >pembangunan bahagian belakang >tutorial php >PHP判断文件是否被引入的方法get_included_files用法示例

PHP判断文件是否被引入的方法get_included_files用法示例

黄舟
黄舟asal
2017-02-25 09:27:011580semak imbas

本文实例讲述了PHP判断文件是否被引入的方法get_included_files用法。分享给大家供大家参考,具体如下:

<?php
// 本文件是 abc.php
include &#39;test1.php&#39;;
include_once &#39;test2.php&#39;;
require &#39;test3.php&#39;;
require_once &#39;test4.php&#39;;
$included_files = get_included_files();
foreach ($included_files as $filename) {
  echo "$filename\n";
}
?>



结果:

以上例程会输出:

abc.php
test1.php
test2.php
test3.php
test4.php



查看phpcms的加载文件

D:\xampp\htdocs\duanzu\index.php
D:\xampp\htdocs\duanzu\phpcms\base.php
D:\xampp\htdocs\duanzu\phpcms\libs\functions\global.func.php
D:\xampp\htdocs\duanzu\phpcms\libs\functions\extention.func.php
D:\xampp\htdocs\duanzu\phpcms\libs\functions\autoload\plugin.func.php
D:\xampp\htdocs\duanzu\phpcms\libs\functions\autoload\video.func.php
D:\xampp\htdocs\duanzu\caches\configs\system.php
D:\xampp\htdocs\duanzu\phpcms\libs\classes\application.class.php
D:\xampp\htdocs\duanzu\phpcms\libs\classes\param.class.php
D:\xampp\htdocs\duanzu\caches\configs\route.php
D:\xampp\htdocs\duanzu\phpcms\modules\home\common.php
D:\xampp\htdocs\duanzu\phpcms\model\user_model.class.php
D:\xampp\htdocs\duanzu\phpcms\libs\classes\model.class.php
D:\xampp\htdocs\duanzu\phpcms\libs\classes\db_factory.class.php
D:\xampp\htdocs\duanzu\caches\configs\database.php
D:\xampp\htdocs\duanzu\phpcms\libs\classes\db_mysqli.class.php
D:\xampp\htdocs\duanzu\phpcms\libs\classes\sendsms.class.php
D:\xampp\htdocs\duanzu\phpcms\plugin\Taobao\TopSdk.php
D:\xampp\htdocs\duanzu\phpcms\plugin\Taobao\Autoloader.php

能够窥探项目的加载流程!

 以上就是PHP判断文件是否被引入的方法get_included_files用法示例 的内容,更多相关内容请关注PHP中文网(www.php.cn)!


Kenyataan:
Kandungan artikel ini disumbangkan secara sukarela oleh netizen, dan hak cipta adalah milik pengarang asal. Laman web ini tidak memikul tanggungjawab undang-undang yang sepadan. Jika anda menemui sebarang kandungan yang disyaki plagiarisme atau pelanggaran, sila hubungi admin@php.cn