search
Homephp教程php手册研究php开源源码的方法与技巧

研究php开源源码的方法与技巧

Jun 13, 2016 am 09:36 AM
phpOpen sourceSkillmethodSource code

本人最近在研究学习phpcms的源码,已经研究了快有一周了,下面结合在网上找的一些研究php开源源码程序分析方法以及自己的见解分享一下如何研究php开源源码的方法以及一些技巧吧。
 
一、首先得把源代码安装起来,让他能够通过http访问。了解一下该应用大概有那些功能以及url是如何进行请求分发的。
 
二、浏览源代码的目录结构,了解各个目录的功能。
 
三、分析源代码框架。例如入口方式是单入口还是多入口,页面之间的调用规则,能根据规则找出某个功能用到的页面。
 
四、熟悉源代码的编码风格,例如变量命名方式,函数以及类的命名方式,缩进方式,排版格式等。
 
五、熟悉一下源代码用到的数据库和表,如果有参考文档可以参考它的技术支持文档。
 
六、经过以上几步相信大家已经对这份源代码有了更深刻的了解,不过这种了解还只是表面的,下来我们从6个方面具体的去分析它吧:
 
1.入口构造以及页面调用方式的具体实现,如果阅读时看到工具类和工具函数,尽量去熟悉一下。分析源代码用到的工具类和工具函数,这样可以学到很多程序编写技巧。可以提升自己编程功力。这一步的分析可以学习到源代码的系统架构方式。
 
2..结合一些安全规则,研究这个源代码是怎样实现安全方面的设计的。这样可以提高自己在安全方面的意识和功力。
 
3.如果有模板引擎的话,研究一下源代码的模板引擎。大致从实现方式,效率,易用性等几个方面去考虑。
 
4.研究系统的各个功能模块,这样既能学习编程技巧还能打开自己的编程思路,下次遇到类似的应用开发就得心应手了。
 
5.研究系统所用到设计模式,一样的功能实现,用到的设计模式可能相差很多,对比我们之前所作的应用分析设计模式,能大大的提升提升我们驾驭代码的功力。
 
7.研究源代码对访问压力,执行效率,系统效率,数据库查询方面的优化,当然这个的前提也得你研究的源码有这方面的考虑才行。

您可能感兴趣的文章

  • 禁止网页右键、复制、另存为、查看源文件等功能实现网页源代码保护
  • PHP实现限制域名从而保护源代码不被拷贝
  • php中的MVC模式运用技巧
  • 程序员开发大型应用程序的技巧
  • php生成随机密码的方法总结
  • 9个很有发展潜力的PHP开源项目 (包括 iphone push 和 phpForAndroid)
  • thinkphp开发技巧总结
  • 男士穿衣搭配技巧
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

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

DVWA

DVWA

Damn Vulnerable Web App (DVWA) is a PHP/MySQL web application that is very vulnerable. Its main goals are to be an aid for security professionals to test their skills and tools in a legal environment, to help web developers better understand the process of securing web applications, and to help teachers/students teach/learn in a classroom environment Web application security. The goal of DVWA is to practice some of the most common web vulnerabilities through a simple and straightforward interface, with varying degrees of difficulty. Please note that this software

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

mPDF

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),

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool