Table of Contents
回复内容:
Home Backend Development PHP Tutorial php类 - 头一次看PHP框架,大家都是怎么看的?例如我现在看的:thinkPHP框架?

php类 - 头一次看PHP框架,大家都是怎么看的?例如我现在看的:thinkPHP框架?

Jun 06, 2016 pm 08:18 PM
php php framework php class

如题,第一次看PHP框架,不知道从何看起。例如,thinkphp。

1:里面的文件那么多,究竟该看什么?不会是每个文件都过一遍吧?

2:看的顺序是怎样的?由于里面的文件是按照一定顺序组织的,不知道怎么理清一个框架的结构顺序?

3:看一个框架的时间大概是多久?

4:大概到了什么程度就算是对一个框架基本掌握?

5:能否说说主流PHP框架之间的差别?选哪个好(可多选)?

头一次接触框架,希望大神门不吝谈谈经验

回复内容:

如题,第一次看PHP框架,不知道从何看起。例如,thinkphp。

1:里面的文件那么多,究竟该看什么?不会是每个文件都过一遍吧?

2:看的顺序是怎样的?由于里面的文件是按照一定顺序组织的,不知道怎么理清一个框架的结构顺序?

3:看一个框架的时间大概是多久?

4:大概到了什么程度就算是对一个框架基本掌握?

5:能否说说主流PHP框架之间的差别?选哪个好(可多选)?

头一次接触框架,希望大神门不吝谈谈经验

1、首先从头看TP的完整版手册,然后进官网看“教程”下的知识
2、看完 1 中的所有知识,然后看一个用TP框架写的项目,根据功能一个一个来理清思路,看完这些,你心中就基本知道TP该如何用了
3、根据你自己的需要来,这个没有明确的时间,主要是看你要掌握到什么程度,看的速度,学习能力,如果你看的快,学的快,又不要求掌握的很好,只要求会一些简单的增删查改,那很快。
4、你能自己单独做出一个简单的项目,实现一些基本的功能,你就入门了。
5、基于本人不是做PHP开发的,目前会的只有TP,但是要说哪个框架好,各有各的不同,这个你可以百度,一搜一大把,具体的要根据你的项目来选择适合你项目的框架,并不是最好的框架就适合你的项目。

以上蓝宝贝@blueangel 已经回答得很详细了,那么我就说说关于常用框架方面的事情吧,symfony据说是php要掌握到一定程度,熟悉各种框架的大神喜欢用的。一般企业通常采用的是Yii框架,我现在用的就是Yii框架和Laravel框架,Yii框架在公司用,Laravel在家自己用,初学者的话,还是先把ThinkPHP框架的思想掌握好吧,建议先掌握最新版的ThinkPHP框架,然后看之前的框架手册或者代码,对比一下得出以前框架的设计问题有什么不好,最新版的Thinkphp框架好在哪里,这个步骤就是熟悉框架的设计思想,至少是Thinkphp框架的设计思想。然后过一年这样进阶Yii框架也好,还是Laravel框架也好,甚至是Symfony也好,都很快,对了,大型企业站通常是用@Laruence 开发的Yaf框架,Yaf框架我没用过,忘记了是C还是C++开发的php底层框架了。

按照官方文档的顺序从头看一遍,再看一些样例项目的代码就行了。我学codeignitet和symfony都是这样的。

第一层是会用,以上诸位都讲的很清楚了。
第二层是会看,把框架的源代码都看一遍,对系统的运行流程有个清楚的认识,比如thinkphp的系统流程

第三层是会写,可以改写框架,甚至自己写个框架出来。

不过自己写了两三年thinkphp的项目了第二层还没学会真是惭愧。。。

从入口文件开始,看一个页面的展示都调用了哪些文件,了解下框架逻辑

下一个IDE,一般都有代码跳转,从入口文件一直看,先过一遍运行流程,TP的话,会了解到 query_string 和控制器的映射,路由在什么时间生效的,再到控制器,控制器之后是模版‘编译’。比较旧了,有些忘了。
看不懂的var_dump大法。
运行流程过了一遍之后,有时间可以看一下TP里相关驱动(缓存啊,DB啊),还有模型类 等的代码。
不求甚解的话,两天就可以过一遍。

先看文档,走流程追代码,一直追到控制器,这是一个循序渐渐的过程

Statement of this Website
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 Article

Roblox: Bubble Gum Simulator Infinity - How To Get And Use Royal Keys
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Nordhold: Fusion System, Explained
4 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
Mandragora: Whispers Of The Witch Tree - How To Unlock The Grappling Hook
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1669
14
PHP Tutorial
1273
29
C# Tutorial
1256
24
PHP and Python: Comparing Two Popular Programming Languages PHP and Python: Comparing Two Popular Programming Languages Apr 14, 2025 am 12:13 AM

PHP and Python each have their own advantages, and choose according to project requirements. 1.PHP is suitable for web development, especially for rapid development and maintenance of websites. 2. Python is suitable for data science, machine learning and artificial intelligence, with concise syntax and suitable for beginners.

PHP in Action: Real-World Examples and Applications PHP in Action: Real-World Examples and Applications Apr 14, 2025 am 12:19 AM

PHP is widely used in e-commerce, content management systems and API development. 1) E-commerce: used for shopping cart function and payment processing. 2) Content management system: used for dynamic content generation and user management. 3) API development: used for RESTful API development and API security. Through performance optimization and best practices, the efficiency and maintainability of PHP applications are improved.

PHP and Python: Different Paradigms Explained PHP and Python: Different Paradigms Explained Apr 18, 2025 am 12:26 AM

PHP is mainly procedural programming, but also supports object-oriented programming (OOP); Python supports a variety of paradigms, including OOP, functional and procedural programming. PHP is suitable for web development, and Python is suitable for a variety of applications such as data analysis and machine learning.

PHP and Python: Code Examples and Comparison PHP and Python: Code Examples and Comparison Apr 15, 2025 am 12:07 AM

PHP and Python have their own advantages and disadvantages, and the choice depends on project needs and personal preferences. 1.PHP is suitable for rapid development and maintenance of large-scale web applications. 2. Python dominates the field of data science and machine learning.

PHP: Handling Databases and Server-Side Logic PHP: Handling Databases and Server-Side Logic Apr 15, 2025 am 12:15 AM

PHP uses MySQLi and PDO extensions to interact in database operations and server-side logic processing, and processes server-side logic through functions such as session management. 1) Use MySQLi or PDO to connect to the database and execute SQL queries. 2) Handle HTTP requests and user status through session management and other functions. 3) Use transactions to ensure the atomicity of database operations. 4) Prevent SQL injection, use exception handling and closing connections for debugging. 5) Optimize performance through indexing and cache, write highly readable code and perform error handling.

PHP's Purpose: Building Dynamic Websites PHP's Purpose: Building Dynamic Websites Apr 15, 2025 am 12:18 AM

PHP is used to build dynamic websites, and its core functions include: 1. Generate dynamic content and generate web pages in real time by connecting with the database; 2. Process user interaction and form submissions, verify inputs and respond to operations; 3. Manage sessions and user authentication to provide a personalized experience; 4. Optimize performance and follow best practices to improve website efficiency and security.

Choosing Between PHP and Python: A Guide Choosing Between PHP and Python: A Guide Apr 18, 2025 am 12:24 AM

PHP is suitable for web development and rapid prototyping, and Python is suitable for data science and machine learning. 1.PHP is used for dynamic web development, with simple syntax and suitable for rapid development. 2. Python has concise syntax, is suitable for multiple fields, and has a strong library ecosystem.

PHP and Python: A Deep Dive into Their History PHP and Python: A Deep Dive into Their History Apr 18, 2025 am 12:25 AM

PHP originated in 1994 and was developed by RasmusLerdorf. It was originally used to track website visitors and gradually evolved into a server-side scripting language and was widely used in web development. Python was developed by Guidovan Rossum in the late 1980s and was first released in 1991. It emphasizes code readability and simplicity, and is suitable for scientific computing, data analysis and other fields.

See all articles