ThinkPHP3.2.3学习笔记4---统计ThinkPHP3.2.3加载的文件
将ThinkPHP3.2.3的入口文件index.php加入一个函数getIncludeFiles,文件内容变成如下所示:
<?php
// +----------------------------------------------------------------------
// | ThinkPHP [ WE CAN DO IT JUST THINK ]
// +----------------------------------------------------------------------
// | Copyright (c) 2006-2014 http://thinkphp.cn All rights reserved.
// +----------------------------------------------------------------------
// | Licensed ( http://www.apache.org/licenses/LICENSE-2.0 )
// +----------------------------------------------------------------------
// | Author: liu21st <liu21st@gmail.com>
// +---------------------------------------------------------------------- // 应用入口文件 // 检测PHP环境
if(version_compare(PHP_VERSION,'5.3.0','<')) die('require PHP > 5.3.0 !'); // 开启调试模式 建议开发阶段开启 部署阶段注释或者设为false
define('APP_DEBUG',True); // 定义应用目录
define('APP_PATH','./Application/'); // 引入ThinkPHP入口文件
require './ThinkPHP/ThinkPHP.php'; // 亲^_^ 后面不需要任何代码了 就是如此简单 getIncludeFiles(); function getIncludeFiles() {
$files = get_included_files(); $fileCount = count($files);
echo "ThinkPHP3.2.3框架共加载{$fileCount}个文件<br />\n";
$i = 0;
foreach ($files as $file) {
$i++;
echo "{$i}、Included file {$file}...<br />\n";
}
}
?>
在浏览中访问http://localhost:81/research/thinkphp_3.2.3_full/index.php
输出如下:
ThinkPHP3.2.3框架共加载27个文件
1、Included file E:\myphp\research\thinkphp_3.2.3_full\index.php...
2、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\ThinkPHP.php...
3、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\Think.class.php...
4、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\Storage.class.php...
5、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\Storage\Driver\File.class.php...
6、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Mode\common.php...
7、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Common\functions.php...
8、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\Hook.class.php...
9、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\App.class.php...
10、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\Dispatcher.class.php...
11、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\Route.class.php...
12、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\View.class.php...
13、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Behavior\BuildLiteBehavior.class.php...
14、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Behavior\ParseTemplateBehavior.class.php...
15、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Behavior\ContentReplaceBehavior.class.php...
16、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Conf\convention.php...
17、Included file E:\myphp\research\thinkphp_3.2.3_full\Application\Common\Conf\config.php...
18、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Lang\zh-cn.php...
19、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Conf\debug.php...
20、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\Log.class.php...
21、Included file E:\myphp\research\thinkphp_3.2.3_full\Application\Home\Conf\config.php...
22、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Behavior\ReadHtmlCacheBehavior.class.php...
23、Included file E:\myphp\research\thinkphp_3.2.3_full\Application\Home\Controller\IndexController.class.php...
24、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Think\Controller.class.php...
25、Included file E:\myphp\research\thinkphp_3.2.3_full\Application\Runtime\Cache\Home\20914c0f075f91df3579ffbdf5180b02.php...
26、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Behavior\WriteHtmlCacheBehavior.class.php...
27、Included file E:\myphp\research\thinkphp_3.2.3_full\ThinkPHP\Library\Behavior\ShowPageTraceBehavior.class.php...
总结:
只是访问入口文件index.php,没有完成任何功能,就加载了27个文件,如果要调用具体的业务逻辑加载的文件还会更多,而且业务中可能还会调用数据库、NoSQL、文件系统、消息队列等系统,一个请求从开始到结束的时间可能会更长。
对于高并发、高可用、高性能的分布式系统来说,性能显得尤为重要,使用框架可能会提高开发效率,但是对性能可能会有一些影响,所以有些大公司采用自己写的框架或不用框架来开发项目。
延伸阅读:
http://www.baidu.com/s?wd=thinkphp%20性能优化
http://www.sogou.com/web?query=thinkphp%20性能优化
https://www.so.com/s?q=thinkphp%20性能优化
http://www.baidu.com/s?wd=程序%20性能优化
http://www.sogou.com/web?query=程序%20性能优化
https://www.so.com/s?q=程序%20性能优化
ThinkPHP3.2.3学习笔记4---统计ThinkPHP3.2.3加载的文件的更多相关文章
- WebGL学习笔记(十二):加载模型文件
目前为止,我们用到的模型顶点uv信息等,都是直接定义在代码中的,实际使用中,这些数据应该是由3D编辑器编辑好后按照一定的格式存储在文件中的,我们需要从文件中提取出对应的数据之后,组合成我们可以使用的信 ...
- 驱动开发学习笔记. 0.07 Uboot链接地址 加载地址 和 链接脚本地址
驱动开发学习笔记. 0.07 Uboot链接地址 加载地址 和 链接脚本地址 最近重新看了乾龙_Heron的<ARM 上电启动及 Uboot 代码分析>(下简称<代码分析>) ...
- Entity Framework学习笔记(五)----Linq查询(2)---贪婪加载
请注明转载地址:http://www.cnblogs.com/arhat 在上一章中,我们使用了Linq对Entity Framework进行了一个查询,但是通过学习我们却发现了懒加载给我来的性能上的 ...
- NGUI学习笔记(四):动态加载UI和NGUI事件
动态加载UI 我们进入一个场景后,如果将这个场景所有可能用到的UI都直接放在场景中做好,由于要在进入场景时就部署好所有的UI对象,那么当UI对象较多时会碰到的问题是:1.初始化场景会产生非常明显的卡顿 ...
- Android学习笔记(二)之异步加载图片
最近在android开发中碰到比较棘手的问题,就是加载图片内存溢出.我开发的是一个新闻应用,应用中用到大量的图片,一个界面中可能会有上百张图片.开发android应用的朋友可能或多或少碰到加载图片内存 ...
- 学习笔记 - 用js判断页面是否加载完成实现代码
用document.onreadystatechange的方法来监听状态改变, 然后用document.readyState == "complete"判断是否加载完成 docum ...
- Django 学习笔记(三) --- HTML 模版加载 css、js、img 静态文件
人生苦短 ~ Tips:仅适用于 Python 3+(反正差别不大,py2 改改也能用).因为据 Python 之父 Guido van Rossum 说会在 2020 年停止对 Python 2 的 ...
- Unity学习笔记(5):动态加载Prefab
第一种方法,从Resources文件夹读取Prefab Assets/Resources文件夹是Unity中的一个特殊文件夹,在博主当前的认知里,放在这个文件夹里的Prefab可以被代码动态加载 直接 ...
- Android学习笔记_50_(转 四种加载方式详解(standard singleTop singleTask singleInstance)
Android之四种加载方式 (http://marshal.easymorse.com/archives/2950 图片) 在多Activity开发中,有可能是自己应用之间的Activity跳转,或 ...
随机推荐
- 利用开源工具实现轻量级上网行为审计(来源ispublic.com)
https://blog.csdn.net/cnbird2008/article/details/5875781
- PAT (Advanced Level) 1033. To Fill or Not to Fill (25)
贪心.注意x=0处没有加油站的情况. #include<cstdio> #include<cstring> #include<cmath> #include< ...
- HOST绑定和VIP映射
今天上线需要配置RAL,处理半天,发现是需要HOST和IP分开来配. 比如: curl -H "Host: ktvin.nuomi.com" "http://10.207 ...
- C语言必会面试题(3、耶稣有13个门徒,当中有一个就是出卖耶稣的叛徒,请用排除法找出这位叛徒:13人围坐一圈,从第一个開始报号:1,2,3,1,2,3...。凡是报到“3”就退出圈子,...)
3.耶稣有13个门徒.当中有一个就是出卖耶稣的叛徒,请用排除法找出这位叛徒:13人围坐一圈,从第一个開始报号:1.2,3.1,2,3.... 凡是报到"3"就退出圈子.最后留在圈子 ...
- 微信通过openID发送消息/后台post、get提交并接收数据 C# .NET 配置404,500等错误信息 连接字符串
微信通过openID发送消息/后台post.get提交并接收数据 控制器:下面是post发送消息(微信不支持从前台发送数据,之前试过,报错,需要跨域,跨域的问题解决后还不行,最后发现之后后端提交 ...
- Windows下的Jupyter Notebook 的介绍(写给新手)(图文详解)
不多说,直接上干货! Windows下的Python 3.6.1的下载与安装(适合32bits和64bits)(图文详解) Windows下的Jupyter Notebook 安装与自定义启动(图文详 ...
- 发挥bat的作用
from 转自:http://blog.csdn.net/hitlion2008/article/details/7467252 1.什么是Windows BATCH BATCH也就是批处理文件,有时 ...
- C语言的各种位运算符的操作简述
运算符: 算术运算符: + , - , * , / , % , ++ , -- 符合运算符: += , *= , /= , %= 条件运算符: ? : 关系运算符: == , >= , < ...
- 导入项目 R.java没有
网上一搜,各种 Android tools-fix your porject或者Clean ...不好使 其实可能是由于XML布局文件有错误导致,修改掉这些错误就可以了..
- mktemp temp race attack 临时文件隐患
/tmp 安全隐患 -/tmp 在家目录 程序目录下 创建 临时文件