Home > php教程 > PHP开发 > Entering Zend Framework Framework Programming 1 (Opening)

Entering Zend Framework Framework Programming 1 (Opening)

黄舟
Release: 2016-12-17 10:19:35
Original
1089 people have browsed it

Opening

This is not only an introductory tutorial for Zend Framework, but also an in-depth interpretation of the ZF application level. I hope it will bring you a pleasant learning process.

1. Current status of PHP development - process-oriented and object-oriented
The development of PHP has not been smooth sailing: from the popularity of PHP3.0 around 2000, to PHP falling into a trough in 2005, to the re-emergence of PHP now, PHP has gone through A winding road. Starting from PHP 5.0, the object-oriented functions tend to be perfected, and then the release of Zend Framework shows Zend's intention and ambition to enter the enterprise development market.
Before 4.0, PHP was mainly process-oriented development, and the code contained a large number of system functions and user-defined functions. But even though PHP5.0 has fully considered the support for classes and objects, most programmers do not actually use objects in their codes much. Programmers are still used to writing structured process-oriented code like asp. The benefits of object-oriented have not been fully exploited by everyone.

2. The concept of framework
A framework is to provide a design that can be used in multiple applications. There are a lot of basic things that are common to all applications, such as interfaces between classes and databases, some program logic, the content the application presents to the user, and so on. If you have written many PHP applications, you will know what these things are. You may have written a set of functions to read data from or write data to the database; you may have used a template engine such as Smarty. If you've written a lot of applications, you've probably done some of the same things over and over again. Sometimes code from one application is copied and pasted into another application.
The framework is specifically designed to provide a structure for these common operations (database interaction, presentation layer, application logic), so that programmers can spend less time writing database interface code or presentation layer interface, and spend more time and Focus on writing the business logic of the application itself. Breaking down an application in this way is called a Model-View-Controller (MVC) architecture. Model refers to the data, view refers to the presentation layer, and controller refers to the application logic or business logic. (You can search online for the specific concepts and explanations of MVC).

3. Framework selection—entering the enterprise development market: Zend Framework (abbreviated as ZF)
Almost every language has several frameworks available. It can be a bit difficult to choose a framework that just meets your business needs, but when choosing a framework, you should ask for it to save as much time and effort as possible. If a framework works very well but costs a lot of support; or even if it is easy to support, it has more negative effects than positive auxiliary development effects, it is not a good framework. If a framework is very "elegant" but has frequent problems in support and development, then the framework is of no use.
When choosing a framework, consider the opinions of customers, programmers, and everyone involved. And when evaluating, consider various impacts. It is also necessary to further consider the project requirements to see if a framework is really needed. A framework is not required, and it is entirely possible to program an application without using a framework.
We need to consider: Will the framework help the project? Will it save everyone time and energy? Will the application perform better in a framework? …if all the answers are no, then using a framework only complicates things.
There are many popular and popular PHP frameworks at present, such as Zend framework, CodeIgniter, symfony, CakePHP, FleaPHP, etc. Choosing to learn a framework may depend on personal preference, but considering its development prospects and popularity, I chose Zend Framework, a framework developed by Zend Company. The main reason is that ZF is from a well-known family and is an authentic direct relative. Moreover, ZF has many similarities in design with the now popular Ruby On Rail (RoR). Learning ZF may also be helpful for future RoR development.

4. Necessary software and recommended environment for learning ZF
All software learning (and development) must start with setting up the environment and installing the software. This time is no exception. Although these tasks are often the responsibility of system administrators, as a programmer, doing these tasks yourself and being familiar with the environment construction and configuration of the software will bring great benefits to program development, because the environment configuration is sometimes directly related to the code. Relationship.
What may be different from the past is that since we work in an open source environment, our software source is downloaded from the Internet. Although PHP is a member of "LAMP" (linux, Apache, MySQL, PHP), when learning and developing, it is generally used to do it under Windows. The reason is that Windows is easy to use, and it is developed under Windows and deployed under Linux. You can check the performance of the code under different OS.
ZF learning is strongly recommended to be carried out in the Apache environment. The reasons will be explained in detail later. After debugging under Apache, you can test under IIS - IIS also requires additional configuration, which will be explained in the future. It is also strongly recommended to develop and deploy actual software projects under Apache rather than under IIS.

5, required software:

Windows Server2003+SP2
mySQL for Windows: Generally installed on the same machine as Windows. It doesn't have to be on the same machine, or it can be mySQL for Linux. Download address: http://www.mysql.cn.
Apache for Windows: The current version of Apache is version 2.2 or above. Download address: http://httpd.apache.org.
PHP and its associated software: This tutorial uses PHP-5.2.5. ZendOptimizer-3.2.6-Windows-i386.exe is installed. Download address: http://www.php.net/downloads.php.
Zend Framework: Zend Framework requires PHP to be version 5.1.4 or later, and it is recommended to be version 5.2.2 or later. 1.5.2 is the latest version of ZF. My tutorial is based on ZF1.5.1, so it should not be much different from ZF1.5.2. Download address: http://framework.zend.com

The above is the content of Introduction to Zend Framework Framework Programming 1 (Opening Chapter). For more related articles, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
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
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template