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

AI Hentai Generator

AI Hentai Generator

Generate AI Hentai for free.

Hot Article

R.E.P.O. Energy Crystals Explained and What They Do (Yellow Crystal)
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
3 weeks ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. How to Fix Audio if You Can't Hear Anyone
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)

PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian PHP 8.4 Installation and Upgrade guide for Ubuntu and Debian Dec 24, 2024 pm 04:42 PM

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

CakePHP Working with Database CakePHP Working with Database Sep 10, 2024 pm 05:25 PM

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

CakePHP Date and Time CakePHP Date and Time Sep 10, 2024 pm 05:27 PM

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

CakePHP File upload CakePHP File upload Sep 10, 2024 pm 05:27 PM

To work on file upload we are going to use the form helper. Here, is an example for file upload.

Discuss CakePHP Discuss CakePHP Sep 10, 2024 pm 05:28 PM

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

CakePHP Creating Validators CakePHP Creating Validators Sep 10, 2024 pm 05:26 PM

Validator can be created by adding the following two lines in the controller.

How To Set Up Visual Studio Code (VS Code) for PHP Development How To Set Up Visual Studio Code (VS Code) for PHP Development Dec 20, 2024 am 11:31 AM

Visual Studio Code, also known as VS Code, is a free source code editor — or integrated development environment (IDE) — available for all major operating systems. With a large collection of extensions for many programming languages, VS Code can be c

CakePHP Logging CakePHP Logging Sep 10, 2024 pm 05:26 PM

Logging in CakePHP is a very easy task. You just have to use one function. You can log errors, exceptions, user activities, action taken by users, for any background process like cronjob. Logging data in CakePHP is easy. The log() function is provide

See all articles