`
wonderfan
  • 浏览: 14070 次
  • 性别: Icon_minigender_1
  • 来自: 武汉
最近访客 更多访客>>
社区版块
存档分类
最新评论

PHP and Zend Framework

阅读更多
The Zend framework's controller,Zend_controller is designed to support websites with clean urls.To achieve this, all requests need

to go through a single index.php file known as the bootstrapper. This provides us with a central point for all pages of the application

and ensures that the environment is set up correctly for running the application. The Zend Framework is designed such that its files

must be on the include path. We also place our models directory on the include path so that we can easily load our model classed

later. To kick off we have to include the files Zend.php to gives us access to the Zend class which has the required static functions to

enable us to load any other Zend Framework class. The front controller uses a router class to map the requested url to the correct

php function to be used for displaying the page. In order for the router to operate, it needs to work out wich part of the url is the path

to our index.php so that ir can look at the url elements after that points. The Zend Framework's controller reserves a special action

called index as a default action. Remember that the model is the part that deals with the application's core purpose and hence deals

with the database. We will make use of the Zend Framework class Zend_ Db_Table which is used to find,insert,update and delete

rows from a database table. To use Zend_Db_Table,we need to tell it which databse to use along with a username and password.

The Zend Framework provides Zend_config to provide flexible object oriented access to configuration files. At the moment, the

configuration file can be a php array ,an ini file or an xml file. Zend_Db_Table is an abstract class .

Filters and Validators can be added to these elements that we have created. There are various ways of adding validators. The view

can be thought of as a templating system. Like a templating system, it allows you to keep all of your display logic separate from your

business logic. In Zend Framework, the view is represented by Zend_View. In most cases, the view is instantiated automatically by

the controller and we access it with $this->view. The view script is what actually contains the display logic necessary to output the

data prepared by your controller action and or your model. The first thing that the view will do upon render() is find the proper script.

The view looks at the controller name,the action name and mergers that with the location of the scripts to create a uri for the view

script. Zend Framework uses the Zend_Db class to connect to a database. Zend-Db and its related classes give you a PDO-like

interface to talk to your database. you have your adapter and you need to fetch some data. Plugins are for when you want to do

something on every request,regardless of the controller,without any interaction with the controller. Plugins require only that you

register the plugin with the front controller.Then the code it encapsulates will be executed. All the code in Plugins in encapsulated in

either the preDispatch() method or the postDispatch() method. Helpers are for when you want shared functionality that you want to

use selectively within controllers and for which you need some introspection or coupling with the controller. Helpers also allow you to

insert functionality before or after any action. As with plugins,helpers have preDispatch() and postDispatch() methods that if exist will

be called automatically. However,helpers also have a direct() method. direct() is called if you make a call directly to the helper.

As with everything in the Zend Framework,action helpers have a default place on the file system. There are several different levels of

model implementation that can be found in applications. The process of verifying logged in status or not is called authentication or

auth.Determing whether a user has specific rights and acting upon those rights is called access control.  Zend_Auth can be a

complicated beast as it allows you to define your own authentication methods using custom adapters. Natively,Zend Framework

comes with three adapters that you can use

,Zend_Auth_Adapter_Dbtable,Zend_Auth_Adapter_Digest,Zend_Auth_Adapter_Http.By extending the

Zend_Auth_Adapter_Interface you can build  your own custom adapters to authenticate against any backend service you choose.

While different adapters may have vastly different options and parameters,they all have one thing in common.,they all return a

Zend_Auth_Result when authenticate() is called.  The nice thing about Zend_Layout is that is accomplishes this task. Zend_Layout is

broken up into the main layout controller as well as a lot of little helpers.
分享到:
评论

相关推荐

    Building PHP Applications with Symfony, CakePHP, and Zend Framework.pdf.rar

    解压密码在:http://www.pin5i.com/showtopic-building-php-applications-with-symfony-cakephp-zend-framework.html

    ZEND FRAMEWORK 1.11.7 中文参考文档

    •Zend Framework Coding Standard for PHP •Overview •PHP File Formatting •Naming Conventions •Coding Style •Zend Framework Documentation Standard •Overview •Documentation File Formatting ...

    Zend Framework 2 Application Development

    Written for PHP developers who want to get started with Zend Framework 2. Whether you are learning Zend framework from scratch or looking to sharpen up your skills from previous versions, Zend ...

    ZendFramework中文手册HTML版

    Zend Framework 是一个开源、基于组件的 PHP 框架,旨在加速 web 应用程序的开发。本手册是由热爱 PHP 的开发者 Haohappy 等人翻译的中文版本,为中国的 PHP 开发者提供了一个方便、易懂的学习资源,以克服语言障碍...

    Zend Framework 2 Documentation Release 2.4.8

    Zend Framework 2 Documentation Release 2.4.8 1 Overview 2 Installation 2.1 Using Composer 2.2 Using Git submodules 2.3 Web Server Setup 3 Getting Started with Zend Framework 2 3.1 Some ...

    ZendFramework中文文档

    1. Introduction to Zend Framework 1.1. 概述 1.2. 安装 2. Zend_Acl 2.1. 简介 2.1.1. 关于资源(Resource) 2.1.2. 关于角色(Role) 2.1.3. 创建访问控制列表(ACL) 2.1.4. 注册角色(Role) 2.1.5. 定义访问...

    [Zend] Zend Framework 2 0 初学者指南 英文版

    Learn about Zend Framework components and use them for functions such as searching image processing and payment gateway integrations Integrate third party services for media sharing and payment ...

    最新zend framework 中文手册

    Zend Framework 是一个基于 Model-View-Controller (MVC) 设计模式的开源PHP Web应用程序框架,它提供了一组强大的工具和服务,帮助开发者构建高质量的、可扩展的Web应用。该框架遵循敏捷开发原则,强调代码重用和...

    zend framework 最新手册

    Zend Framework 是一个开源的、基于 PHP 语言的 Web 应用开发框架,它遵循 Model-View-Controller (MVC) 设计模式,为开发者提供了一套强大的工具和服务,以提高开发效率和代码质量。最新手册针对的是 Zend ...

    Zend Framework中文手册

    Zend Framework 是一个基于 Model-View-Controller (MVC) 设计模式的开源 PHP Web 应用程序开发框架。这个框架强调可重用性、组件化和最佳实践,以促进高效、稳定的开发。中文手册是开发者理解和使用 Zend Framework...

    Manning Zend Framework in Action

    - **环境搭建**:包括安装 PHP、配置开发环境以及安装 Zend Framework 的步骤。 - **基本示例**:通过一个简单的“Hello World”应用程序来演示如何创建和运行 Zend Framework 项目。 **3. Building a Website with...

    Easy PHP Websites with the Zend Framework

    Introducing the Zend Framework CHAPTER 6. Talking to the Database with Zend_Db CHAPTER 7. Processing Forms and Sending Email CHAPTER 8. Managing Your User Community CHAPTER 9. Integrating Google ...

    zend framework 对内容进行编辑

    6. **路由与调度(Routing and Dispatching)**:在 Zend Framework 中,URL 路由和调度是通过 Zend_Controller_Front 实现的。编辑页面的 URL 可以被映射到特定的控制器和动作,例如 `/edit/:id` 可能会映射到 `...

    Zend Framework 2 Cookbook

    A couple of years ago I was introduced to Zend Framework 1 by a friend of mine, and since then I have been a fan. Although the first framework was a real bulky framework with not much documentation, I...

    [Zend] Zend Framework 2 应用开发教程 (英文版)

    Written in a framework and the API-centric approach to simplify the process of learning ☆ 出版信息:☆ [作者信息] Christopher Valles [出版机构] Packt Publishing [出版日期] 2013年10月25日 [图书...

    easy php websites with the zend framework

    Jason Gilmore 编写,他同时也是《Beginning PHP and MySQL》第三版的畅销书作者。书中不仅涵盖了 PHP 的基本概念,还深入介绍了如何结合 Zend 框架与多种现代 Web 技术(如 MySQL、Ajax、RSS、PayPal、Facebook ...

    zendframework数据库总结

    ### zendframework数据库操作总结 #### 一、概述 在ZEND FRAMEWORK(简称ZF)中,数据库操作是一项非常重要的功能,它提供了丰富的API来帮助开发者更便捷地与数据库交互。本文将详细介绍ZF中的几种主要数据库操作...

    Zend Framework的Serializer组件-PHP开发

    https://github.com/zendframework/zend-serializer/issues上的文件问题Documen zend-serializer zend-serializer提供了一个基于适配器的接口,用于从可存储PHP类型表示中生成和恢复。 文件问题位于...

Global site tag (gtag.js) - Google Analytics