search
HomeBackend DevelopmentPHP Tutorial个人观点,道一下对 PHPCMS 的网站架构的看法

个人观点,说一下对 PHPCMS 的网站架构的看法

PHPCMS应该是国内第一家用MVC架构来写开源PHP产品的,我第一次工作上接触到PHPCMS是在两年前,那个时候对MVC还是不理解,然后因为工作需要,需要修改一下PHPCMS的源码。拿到代码后,我一开始还本着一种从PHPCMS入手来理解MVC模式,可研究了半天,心里一直想着这就是人人称赞的MVC架构吗?怎么而看都感觉不出哪里的优势,却让人很容易联想到discuz的架构。


(截图:phpcms的源码,来自文件D:\www\phpcms\phpcms\modules\content\content.php)


今天重新拿到PHPCMS的代码,重新看了下。

在自己理解了MVC,并且看过大部分的人气比较高的MVC框架,国内的ThinkPHP、国外的symfony2 laravel以及yii之后再来看PHPCMS,再来评价下PHPCMS:

1)结构混乱,命名没有任何规则,比如前台可以访问的加action前缀之类的。

2)有必要在开头第一段写上判断吗?为什么不直接用.htaccess禁止任何人访问 /phpcms这个目录?

3)phpsso_server 这个目录写法完全是抄袭discuz,拖油瓶。

4)phpcms一直宣称MVC,让人觉得技术上很厉害,但是实际上运行起来非常缓慢,卡得无比。


PHPCMS是用PHP4的架构思路来完成MVC模式。

今天重新看了PHPCMS的源码,才明白了自己当时为什么会有那种感受“这就是传说中人人称赞的MVC吗”,还对MVC产生排斥感。PHPCMS的写法完全是一种PHP4的写法,严格来说根本就不符合MVC规范,根本就不是MVC架构!最后要说的是,用PHP4的思路架构写出PHPCMS这样一个系统来,比用MVC写出来累,且维护成本比流行MVC框架开发出来的程序高(时间精力上)。(by default7#zbphp.com)


Statement
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
What data can be stored in a PHP session?What data can be stored in a PHP session?May 02, 2025 am 12:17 AM

PHPsessionscanstorestrings,numbers,arrays,andobjects.1.Strings:textdatalikeusernames.2.Numbers:integersorfloatsforcounters.3.Arrays:listslikeshoppingcarts.4.Objects:complexstructuresthatareserialized.

How do you start a PHP session?How do you start a PHP session?May 02, 2025 am 12:16 AM

TostartaPHPsession,usesession_start()atthescript'sbeginning.1)Placeitbeforeanyoutputtosetthesessioncookie.2)Usesessionsforuserdatalikeloginstatusorshoppingcarts.3)RegeneratesessionIDstopreventfixationattacks.4)Considerusingadatabaseforsessionstoragei

What is session regeneration, and how does it improve security?What is session regeneration, and how does it improve security?May 02, 2025 am 12:15 AM

Session regeneration refers to generating a new session ID and invalidating the old ID when the user performs sensitive operations in case of session fixed attacks. The implementation steps include: 1. Detect sensitive operations, 2. Generate new session ID, 3. Destroy old session ID, 4. Update user-side session information.

What are some performance considerations when using PHP sessions?What are some performance considerations when using PHP sessions?May 02, 2025 am 12:11 AM

PHP sessions have a significant impact on application performance. Optimization methods include: 1. Use a database to store session data to improve response speed; 2. Reduce the use of session data and only store necessary information; 3. Use a non-blocking session processor to improve concurrency capabilities; 4. Adjust the session expiration time to balance user experience and server burden; 5. Use persistent sessions to reduce the number of data read and write times.

How do PHP sessions differ from cookies?How do PHP sessions differ from cookies?May 02, 2025 am 12:03 AM

PHPsessionsareserver-side,whilecookiesareclient-side.1)Sessionsstoredataontheserver,aremoresecure,andhandlelargerdata.2)Cookiesstoredataontheclient,arelesssecure,andlimitedinsize.Usesessionsforsensitivedataandcookiesfornon-sensitive,client-sidedata.

How does PHP identify a user's session?How does PHP identify a user's session?May 01, 2025 am 12:23 AM

PHPidentifiesauser'ssessionusingsessioncookiesandsessionIDs.1)Whensession_start()iscalled,PHPgeneratesauniquesessionIDstoredinacookienamedPHPSESSIDontheuser'sbrowser.2)ThisIDallowsPHPtoretrievesessiondatafromtheserver.

What are some best practices for securing PHP sessions?What are some best practices for securing PHP sessions?May 01, 2025 am 12:22 AM

The security of PHP sessions can be achieved through the following measures: 1. Use session_regenerate_id() to regenerate the session ID when the user logs in or is an important operation. 2. Encrypt the transmission session ID through the HTTPS protocol. 3. Use session_save_path() to specify the secure directory to store session data and set permissions correctly.

Where are PHP session files stored by default?Where are PHP session files stored by default?May 01, 2025 am 12:15 AM

PHPsessionfilesarestoredinthedirectoryspecifiedbysession.save_path,typically/tmponUnix-likesystemsorC:\Windows\TemponWindows.Tocustomizethis:1)Usesession_save_path()tosetacustomdirectory,ensuringit'swritable;2)Verifythecustomdirectoryexistsandiswrita

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

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

Hot Tools

WebStorm Mac version

WebStorm Mac version

Useful JavaScript development tools

SublimeText3 English version

SublimeText3 English version

Recommended: Win version, supports code prompts!

EditPlus Chinese cracked version

EditPlus Chinese cracked version

Small size, syntax highlighting, does not support code prompt function

ZendStudio 13.5.1 Mac

ZendStudio 13.5.1 Mac

Powerful PHP integrated development environment

Atom editor mac version download

Atom editor mac version download

The most popular open source editor