


A summary of Zend Framework introductory knowledge points, zendframework
This article summarizes and analyzes the Zend Framework introductory knowledge points. Share it with everyone for your reference, the details are as follows:
zend framework is an implementation of the MVC pattern. To get started quickly, just look at the Zend_Controller Zend_View part.
1.Zend_Controller part. The most important class is Zend_Controller_Front. The classic code to use it is simple:
$front=Zend_Controller_Front::getInstance(); $front-> setControllerDirectory("./app/controllers"); $front->dispatch();
What should be explained here is that you cannot use new to obtain a Zend_Controller_Front. You can only call the getInstance method to return an instance (my zend_framework uses 1.01). The controllers directory I specified here is under the app folder under the www document root directory. Generally speaking, apps should not be placed in the document root directory - the so-called security issue: if the configuration is not strict, the files in the www document root directory may be visible to visitors. Generally, it should be placed in another directory. For example, if it is placed at the same level as the document root directory, you can use:
$front->setControllerDirectory("../app/controllers")
There is one more ".". Relative paths are used here. You can specify other directories using their full path names. For example:
$front->setControllerDirectory("E: /server/app/controllers")
This part is included in the index. in php. Under the correct configuration, any request will be redirected by the rewrite function to this $front, which is the front-end controller Zend_Controller_Front instance. All authentication and other processing must be processed before dispatch.
2.Zend_View common codes are:
$view=new Zend_View(); Zend_Registry::set("view".$view);
The directory structure recommended by Zend_Framework is adopted by default. That is, views and controllers models are all in the application directory. There are three sibling directories under views: scrīpts helpers filters. In this way, when you define a Controller, you have to create a new directory under scrīpts to store the templates subordinate to the Controller. For example, a simple
Class IndexController extends Zend_Controller_Action { function IndexAction() { } }
You need to create an index directory accordingly, and create an index.phtml template under the index directory. If you create another function addAction() under IndexController, you have to create a new add.phtml in index. If you have another UserController, you must have a corresponding user directory under scrīpts. These *.phtml files are similar to html files and define how the content you output is displayed. You can simply leave it blank. But it cannot be left out, otherwise it will prompt "error" invalid Controller... This is because the default ErrorController has already been registered. The default ErrorController will be called when the front-end controller cannot find the corresponding controller distribution.
Sometimes we don’t want to use the default directory structure or the default phtml type view template. At this time we can use
$view->setParam ("noViewRanderer",true);
to cancel the default phtml type directory setting. Use
$view->setParam ("noErrorHandler",true);
to write in the default ErrorController. Use
$view->setscrīptPath ("./app/views");
to set the location of your template. This is useful when using smarty templates.
You can write:
$view=new Zend_View_Smarty(); $view->setParam("noViewRanderer",true); $view->setParam("noErrorHandler",true); $view->setscrīptPath("./app/views"); Zend_Registry::set("view".$view);
You can get it like this when using:
$view=Zend_Registry::get("view");
3. When you first come into contact with it, the model can be simply understood as a data object. For those who operate the database, you can generally directly inherit the Zend_Db_Table class. This class is very encapsulated and is enough for general use:
class data extends Zend_Db_Table { protected $_name="data"; }
You only need to specify the name of the table. Of course, you don’t need to specify it explicitly. In this case, zendf will use your class name to search for the table in the database by default. Don’t forget to specify defaultAdapter for Zend_Db_Table:
$config = new Zend_Config_Ini('./application/config.ini', 'general'); $db = Zend_Db::factory($config->db->adapter, $config->db->config->toArray()); Zend_Db_Table::setDefaultAdapter($db);
config.ini is similar to [general]
db.adapter = PDO_MYSQL db.config.host = localhost db.config.username = rob db.config.password = 123456 db.config.dbname = zftest
Readers who are interested in more zend-related content can check out the special topics of this site: "Zend FrameWork Framework Introductory Tutorial", "php Excellent Development Framework Summary", "Yii Framework Introduction and Summary of Common Techniques", "ThinkPHP Introductory Tutorial" , "php object-oriented programming introductory tutorial", "php mysql database operation introductory tutorial" and "php common database operation skills summary"
I hope this article will be helpful to everyone’s PHP programming based on the Zend Framework framework.
Articles you may be interested in:
- Zend Framework Tutorial: Zend_Db_Table_Row Usage Example Analysis
- Zend Framework Tutorial: Zend_Db_Table Usage Detailed Explanation
- Zend Framework Cache Simple usage example
- Zend Framework basic page layout analysis
- Zend Framework connection Mysql database instance analysis
- Zend Framework smarty usage example detailed explanation
- Zend Framework tutorial Detailed explanation of Application usage examples
- Summary of precautions related to Zend Framework custom Helper class
- Overview of Bootstrap class usage in Zend Framework tutorial
- Detailed explanation of Autoloading usage in Zend Framework tutorial
- Zend Framework Tutorial: Controller Usage Analysis of MVC Framework
- Zend Framework Tutorial: Zend_Db_Table_Rowset Usage Example

.NETFramework4是开发人员和最终用户在Windows上运行最新版本的应用程序所必需的。但是,在下载安装.NETFramework4时,许多用户抱怨安装程序在中途停止,显示以下错误消息-“ .NETFramework4hasnotbeeninstalledbecauseDownloadfailedwitherrorcode0x800c0006 ”。在您的设备上安装.NETFramework4时,如果您也在体验它,那么您就来对了地方

每当您的Windows11或Windows10PC出现升级或更新问题时,您通常会看到一个错误代码,指示故障背后的实际原因。但是,有时,升级或更新失败可能不会显示错误代码,这时就会出现混淆。有了方便的错误代码,您就可以确切地知道问题出在哪里,因此您可以尝试修复。但是由于没有出现错误代码,因此识别问题并解决它变得极具挑战性。这会占用您大量时间来简单地找出错误背后的原因。在这种情况下,您可以尝试使用Microsoft提供的名为SetupDiag的专用工具,该工具可帮助您轻松识别错误背后的真
![SCNotification 已停止工作 [修复它的 5 个步骤]](https://img.php.cn/upload/article/000/887/227/168433050522031.png)
作为Windows用户,您很可能会在每次启动计算机时遇到SCNotification已停止工作错误。SCNotification.exe是一个微软系统通知文件,由于权限错误和点网故障等原因,每次启动PC时都会崩溃。此错误也以其问题事件名称而闻名。因此,您可能不会将其视为SCNotification已停止工作,而是将其视为错误clr20r3。在本文中,我们将探讨您需要采取的所有步骤来修复SCNotification已停止工作,以免它再次困扰您。什么是SCNotification.e

Vue.js是一款流行的JavaScript前端框架,目前已经推出了最新的版本——Vue3,新版Vue在性能、体积以及开发体验上均有所提升,受到越来越多的开发者欢迎。本文将介绍如何使用Vue3制作一个简单的图片裁剪器。首先,我们需要创建一个Vue项目并安装所需的插件。可以使用VueCLI来创建项目,也可以手动搭建。这里我们以使用VueCLI的方式为例:#

已安装Microsoft.NET版本4.5.2、4.6或4.6.1的MicrosoftWindows用户如果希望Microsoft将来通过产品更新支持该框架,则必须安装较新版本的Microsoft框架。据微软称,这三个框架都将在2022年4月26日停止支持。支持日期结束后,产品将不会收到“安全修复或技术支持”。大多数家庭设备通过Windows更新保持最新。这些设备已经安装了较新版本的框架,例如.NETFramework4.8。未自动更新的设备可能

自我们谈论影响安装KB5012643forWindows11的用户的新安全模式错误以来已经过去了一周。这个讨厌的问题并没有出现在微软在发布当天发布的已知问题列表中,因此让所有人都感到意外。好吧,就在您认为情况不会变得更糟的时候,微软为安装此累积更新的用户投下了另一颗炸弹。Windows11Build22000.652导致更多问题因此,这家科技公司警告Windows11用户,他们在启动和使用某些.NETFramework3.5应用程序时可能会遇到问题。听起来很熟悉?不过请不要惊

如何在Zend框架中使用ACL(AccessControlList)进行权限控制导言:在一个Web应用程序中,权限控制是至关重要的一项功能。它可以确保用户只能访问其有权访问的页面和功能,并防止未经授权的访问。Zend框架提供了一种方便的方法来实现权限控制,即使用ACL(AccessControlList)组件。本文将介绍如何在Zend框架中使用ACL

PHP实现框架:ZendFramework入门教程ZendFramework是PHP开发的一种开源网站框架,目前由ZendTechnologies维护,ZendFramework采用了MVC设计模式,提供了一系列可重用的代码库,服务于实现Web2.0应用程序和Web服务。ZendFramework深受PHP开发者的欢迎和推崇,拥有广泛


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function

MantisBT
Mantis is an easy-to-deploy web-based defect tracking tool designed to aid in product defect tracking. It requires PHP, MySQL and a web server. Check out our demo and hosting services.

SublimeText3 Linux new version
SublimeText3 Linux latest version

PhpStorm Mac version
The latest (2018.2.1) professional PHP integrated development tool