Problems in common php frameworks such as ZF started with Zend Framework v0.13 and I began to learn how to use Zend Framework. At that time, Zend Framework was also used for a company project. No more details will be taken into account after version 0.6. A few days ago, I heard that Zend will officially launch the Zend Framework in March. today, I specifically asked my colleagues to download and test it.
The latest version is 0.93, and tests show that the Zf framework is getting dumb. Many things are directly encapsulated in the ZF library. You only need to know how to call it. Compared with the previous version, the details are indeed quite different, and more functions are also added.
First, Zend. php disappears and is replaced by a Zend_load class, which is placed in load. php.
Second, it is more convenient to load the library class. It is troublesome to use ZF in sub-directories. Now it can be used directly in sub-directories, and it can be used without mod_rewrite. it can be accessed through http: // path/to/site/controller/action, this is similar to the URL ing I mentioned in my answer to PHPCHINA: URL ING.
Third, integrate the attempt into the Controller for convenient calling. However, the bad thing is to standardize the directory structure of the program according to ZF's requirements.
In addition, many functions are added, such as access control. In short, the changes are great. I just thought about it this evening.
For ZF, cakephp, and other frameworks, I think it is best for everyone to understand the basic principles of the framework while learning it ". The framework itself is very simple, and there is no such complexity as ZF. they only process the details well. at the same time, they need to be universal, standardized, and powerful, so it is complicated. For the basic principles of the framework, I recommend you read an article on phpit.net about how to use PHP5 to build a simple MVC framework (there are translations in Joy International ), you can also read my several articles, "the simplest way to implement MVC in PHP.
I have posted a post on chinaunix to discuss the advantages and disadvantages of using objects and processes in PHP projects. Some people who support objects also think that non-object development is more in line with the characteristics of WEB development and has better performance.
Personally, I am very supportive of object-based development, especially in the PHP5 environment (because the PHP5 object is not the same as the PHP4 object at all, let's look at the Zend Engine ). However, the points mentioned in The Post also make sense: for example, "the OOP form requires many irrelevant functions to be loaded for no reason ". WEB development emphasizes performance, while PHP is an explanatory language. if too much code is included, performance is greatly affected. This problem exists in Zend Framework, CackePHP, Fleaphp, and my Framework PHPbean.
For example, an indexController uses Zend Framework as an example. The code is as follows:
Class indexController extends Zend_Controller_Action {
Function init (){
$ This-> initView ();
}
Function indexAction (){
// Echo 'index/index ';
$ This-> view-> title = 'Hello World! ';
$ This-> render ();
}
Function testAction (){
Echo 'index/test ';
}
Function showAction (){
Echo 'index/Show ';
}
}
?>
For example, if we Access index/index, the content of the testAction () and ShowAction () methods is completely redundant. In actual development, a function module corresponds to a controller. for example, a user corresponds to a userController, there are multiple methods such as logon, logout, registration, list, and detailed display. When a project is large, a controller may be several K to a dozen K. This mode is very bad.
JAVA struts uses a completely different method. it is an action that corresponds to a file. I think this is a good reference method.
I think PHP5 is more time-oriented. It can be said that the process can be implemented, the object can be implemented, and the implementation can be better. But it is important to use the object-oriented thinking instead of the process-oriented thinking to write the object-oriented program!
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service