Home Backend Development PHP Tutorial Problems existing in common PHP frameworks such as ZF

Problems existing in common PHP frameworks such as ZF

Jul 29, 2016 am 08:37 AM
controller framework index nbsp zend

Starting from Zend Framework v0.13 version, I began to learn to use Zend Framework. One of the company's projects at that time also happened to use Zend Framework. After version 0.6, I no longer paid attention to details. I heard a few days ago that Zend Company will officially launch Zend Framework in May. Today I specially asked my classmates to download it and test it.
The latest version is 0.93. The test found that the Zf framework is becoming more and more fool-like. Many things are directly packaged in ZF's library. As long as you know how to call it, it's OK. There are indeed major changes from the previous version, and more functions have been added.
First of all, Zend.php is gone, replaced by a Zend_load class, placed in load.php.
Second, loading library classes is more convenient. The previous ZF was more troublesome to use in subdirectories. It can now be used directly in subdirectories, and it can now be used without mod_rewrite. It can be accessed through http://path/to/site/controller/action, similar to what I wrote in "Answering several questions on PHPCHINA: URL Mapping" talks about URL mapping.
Third, the view is directly integrated into the Controller for easy calling. However, one disadvantage is that the directory structure of the program must be standardized according to the requirements of the government.
In addition, many functions have been added, such as access control and so on. All in all, a lot has changed. I only took a brief look at it tonight.
For frameworks such as ZF, cakephp, etc., I think it is best for everyone to understand the basic principles of the framework when learning. The so-called "everything is inseparable". The framework itself is very simple, not as complex as ZF and the like. They just handle the details very well, and at the same time they have to be universal, standardized, and powerful, so they are complicated. Regarding the basic principles of the framework, I recommend you to read an article on phpit.net about how to use PHP5 to build a simple MVC framework (translated on Joy International Village), or you can read several of my articles "PHP The easiest way to implement MVC development" series of articles.
There was a post on chinaunix before, discussing the advantages and disadvantages of using objects and procedures in PHP projects. The discussion was very good. Some support objects, while others believe that non-object development is more in line with the characteristics of WEB development and has better performance.
I personally strongly support object-based development, especially in the PHP5 environment (because the objects of PHP5 and the objects of PHP4 are completely different, just look at the Zend engine to know this). But the points mentioned in the post are also very reasonable: for example, "the form of OOP has to be loaded with many irrelevant functions for no reason."WEB development places great emphasis on performance, and PHP is an interpreted language. If too much code is included, performance will be greatly affected. This problem exists in Zend Framework, CackePHP, Fleaphp and my framework PHPbean.
For example, an indexController, here we use Zend Framework as an example. The code is as follows:
class indexController extends Zend_Controller_Action {
function init(){
$this->initView();            //echo 'index/index';                                                   ->view->title='hello World!';
                                                                                                 Action(){
echo 'index/show';
}
}
?>
For example, if we access index/index, then the contents of the testAction() and ShowAction() methods are completely redundant. In actual development, according to this idea, a functional module generally corresponds to a controller. For example, a user corresponds to a userController, and there are many methods such as login, logout, registration, list, detailed display, etc. When a project is large, a controller may only have a few K to more than ten K. Then this model is very bad.
In JAVA’s struts, a completely different approach is adopted. One action corresponds to one file. I think this is a good reference method.
I think in PHP5, it is better to use object-oriented. It can be said that what can be achieved when facing processes can be achieved when facing objects, and it can be achieved even better. But the important point is: use object-oriented thinking to use object-oriented thinking, rather than using process-oriented thinking to write object-oriented programs!​
The above introduces the problems existing in common PHP frameworks such as ZF, including aspects of the content. I hope it will be helpful to friends who are interested in PHP tutorials.


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)
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
R.E.P.O. Best Graphic Settings
1 months ago By 尊渡假赌尊渡假赌尊渡假赌
Will R.E.P.O. Have Crossplay?
1 months 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)

Solution: Your organization requires you to change your PIN Solution: Your organization requires you to change your PIN Oct 04, 2023 pm 05:45 PM

The message "Your organization has asked you to change your PIN" will appear on the login screen. This happens when the PIN expiration limit is reached on a computer using organization-based account settings, where they have control over personal devices. However, if you set up Windows using a personal account, the error message should ideally not appear. Although this is not always the case. Most users who encounter errors report using their personal accounts. Why does my organization ask me to change my PIN on Windows 11? It's possible that your account is associated with an organization, and your primary approach should be to verify this. Contacting your domain administrator can help! Additionally, misconfigured local policy settings or incorrect registry keys can cause errors. Right now

How to adjust window border settings on Windows 11: Change color and size How to adjust window border settings on Windows 11: Change color and size Sep 22, 2023 am 11:37 AM

Windows 11 brings fresh and elegant design to the forefront; the modern interface allows you to personalize and change the finest details, such as window borders. In this guide, we'll discuss step-by-step instructions to help you create an environment that reflects your style in the Windows operating system. How to change window border settings? Press + to open the Settings app. WindowsI go to Personalization and click Color Settings. Color Change Window Borders Settings Window 11" Width="643" Height="500" > Find the Show accent color on title bar and window borders option, and toggle the switch next to it. To display accent colors on the Start menu and taskbar To display the theme color on the Start menu and taskbar, turn on Show theme on the Start menu and taskbar

How to change title bar color on Windows 11? How to change title bar color on Windows 11? Sep 14, 2023 pm 03:33 PM

By default, the title bar color on Windows 11 depends on the dark/light theme you choose. However, you can change it to any color you want. In this guide, we'll discuss step-by-step instructions for three ways to change it and personalize your desktop experience to make it visually appealing. Is it possible to change the title bar color of active and inactive windows? Yes, you can change the title bar color of active windows using the Settings app, or you can change the title bar color of inactive windows using Registry Editor. To learn these steps, go to the next section. How to change title bar color in Windows 11? 1. Using the Settings app press + to open the settings window. WindowsI go to "Personalization" and then

What file is index.html? What file is index.html? Feb 19, 2024 pm 01:36 PM

index.html represents the home page file of the web page and is the default page of the website. When a user visits a website, the index.html page is usually loaded first. HTML (HypertextMarkupLanguage) is a markup language used to create web pages, and index.html is also an HTML file. It contains the structure and content of a web page, as well as tags and elements used for formatting and layout. Here is an example index.html code: &lt

OOBELANGUAGE Error Problems in Windows 11/10 Repair OOBELANGUAGE Error Problems in Windows 11/10 Repair Jul 16, 2023 pm 03:29 PM

Do you see "A problem occurred" along with the "OOBELANGUAGE" statement on the Windows Installer page? The installation of Windows sometimes stops due to such errors. OOBE means out-of-the-box experience. As the error message indicates, this is an issue related to OOBE language selection. There is nothing to worry about, you can solve this problem with nifty registry editing from the OOBE screen itself. Quick Fix – 1. Click the “Retry” button at the bottom of the OOBE app. This will continue the process without further hiccups. 2. Use the power button to force shut down the system. After the system restarts, OOBE should continue. 3. Disconnect the system from the Internet. Complete all aspects of OOBE in offline mode

How to enable or disable taskbar thumbnail previews on Windows 11 How to enable or disable taskbar thumbnail previews on Windows 11 Sep 15, 2023 pm 03:57 PM

Taskbar thumbnails can be fun, but they can also be distracting or annoying. Considering how often you hover over this area, you may have inadvertently closed important windows a few times. Another disadvantage is that it uses more system resources, so if you've been looking for a way to be more resource efficient, we'll show you how to disable it. However, if your hardware specs can handle it and you like the preview, you can enable it. How to enable taskbar thumbnail preview in Windows 11? 1. Using the Settings app tap the key and click Settings. Windows click System and select About. Click Advanced system settings. Navigate to the Advanced tab and select Settings under Performance. Select "Visual Effects"

Display scaling guide on Windows 11 Display scaling guide on Windows 11 Sep 19, 2023 pm 06:45 PM

We all have different preferences when it comes to display scaling on Windows 11. Some people like big icons, some like small icons. However, we all agree that having the right scaling is important. Poor font scaling or over-scaling of images can be a real productivity killer when working, so you need to know how to customize it to get the most out of your system's capabilities. Advantages of Custom Zoom: This is a useful feature for people who have difficulty reading text on the screen. It helps you see more on the screen at one time. You can create custom extension profiles that apply only to certain monitors and applications. Can help improve the performance of low-end hardware. It gives you more control over what's on your screen. How to use Windows 11

Microsoft NET Framework Installation Issues Error Code 0x800c0006 Fix Microsoft NET Framework Installation Issues Error Code 0x800c0006 Fix May 05, 2023 pm 04:01 PM

.NET Framework 4 is required by developers and end users to run the latest versions of applications on Windows. However, while downloading and installing .NET Framework 4, many users complained that the installer stopped midway, displaying the following error message - " .NET Framework 4 has not been installed because Download failed with error code 0x800c0006 ". If you are also experiencing it while installing .NETFramework4 on your device then you are at the right place

See all articles