前段时间仔细看了一下PHPCMS这套开源的系统,实现了程序与模板分离,觉得写得真的不错。本人很少关注开源系统,尤其是PHP的,觉得PHP本身就是一个宠大的函数库,
下面我讲讲关于这套系统的加载流程
定义根目录,定义include目录
加载核心文件
配置文件'config.inc.php'
全局函数'global.func.php'
目录操作函数'dir.func.php'
url相关函数'url.func.php'
数据输出相关类'output.class.php'
权限类'priv_group.class.php'
时间处理类'times.class.php'
加载语言数组'phpcms.lang.php'
加载数库存类'db_mysql.class.php'
定义常量,大部分我们常用的信息如IP,HTTP_REFERER,SCRIPT_NAME...一律用常量
获得变量,从$_POST,$_GET,$_COOKIE,-> extract
读取CACHE,香港服务器,cache_read函数大部分都是读取的一些数组文件,然后extract (extract每个数组都别忘了unset)
获得当前$mod,香港虚拟主机,默认是PHPCMS
判断用户是否登录
读取会员组权限
读取模板文件,通过template函数
首先会读取根据参数生成cache模板php文件
判断是否存在该文件并且该文件 TPL_ROOT.TPL_NAME.'/'.$module.'/'.$template.'.html'生成日期是否等于TPL_CACHEPATH.$module.'_'.$template.'.tpl.php',否则重新编译和生成tpl文件
读取tpl文件
这套CMS的优点在于程序与模板分离,将常用的数据通过以数组形式存取在文件上面,提升了很高的性能,不用每次都从数据库来读取,然后就是template,免备案空间,通过自带的语法函数编译后存取为tpl增加了模板的灵活性,美工不用懂得PHP语法,也能灵活的写布局;里面自带的TAG功能也不错。
缺点在于,一次性加载了太多的不需的文件在内存中,尤其是都是以变量和数组形式,不管是否用得着。
亮点在于,可以很方便生成HTML,弥补了缺点,总体来说架构和思路相当不错,值得学习和二次开发!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

SublimeText3 Linux new version
SublimeText3 Linux latest version

mPDF
mPDF is a PHP library that can generate PDF files from UTF-8 encoded HTML. The original author, Ian Back, wrote mPDF to output PDF files "on the fly" from his website and handle different languages. It is slower than original scripts like HTML2FPDF and produces larger files when using Unicode fonts, but supports CSS styles etc. and has a lot of enhancements. Supports almost all languages, including RTL (Arabic and Hebrew) and CJK (Chinese, Japanese and Korean). Supports nested block-level elements (such as P, DIV),

Zend Studio 13.0.1
Powerful PHP integrated development environment

SecLists
SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.