1. Trang chủ
  2. » Công Nghệ Thông Tin

Zend Framework : Quick Start Walkthrough - Khởi động với Zend Framework

21 338 0

Đang tải... (xem toàn văn)

Tài liệu hạn chế xem trước, để xem đầy đủ mời bạn chọn Tải xuống

THÔNG TIN TÀI LIỆU

Thông tin cơ bản

Định dạng
Số trang 21
Dung lượng 79,2 KB

Nội dung

Hướng dẫn cơ bản khi muốn làm quen với Zend Framework, framwork được viết trên ngôn ngữ PHP bởi nhóm phát triển PHP.

Zend Framework Quick Start Walk Through Bradley Holt <bradley.holt@foundline.com> Found Line Introduction Zend Framework is a "glue" framework that also provides an MVC "stack." Provides much flexibility but "best practices" are still sometimes hard to figure out (there are proposals that address this such as Zend_Console & Zend_Build). This presentation will focus mainly on what is suggested in Zend Framework documentation. Why We Chose Zend Framework Clear separation between design and development (MVC) Gives a starting point for code reuse (coding standards, namespace organization, etc.) "Use-at-will" architecture - if I don't like something I can extend or replace it Great documentation Permissive open source license (modified BSD) Doesn't hurt to have "The PHP Company" behind it Resources Zend Framework installation Zend_Controller quick start Example web application on Google Code Installation Make sure you have PHP 5.1.4 or later (full system requirements). Download the latest stable release, download the latest nightly snapshot, or use a Subversion (SVN) client to get a copy of Zend Framework. Make sure your PHP include_path contains the path to the Zend Framework library. Zend Framework contains many components that may now be used in your web application even if you decide not to use Zend Framework MVC. Zend Framework MVC Overview Model - many options including Zend_Db & Zend_Service View - Zend_View Controller - Zend_Controller Zend_Controller_Front uses a Front Controller pattern. Incoming requests are dispatched to Action Controllers based on the requested URL: http://example.com http://example.com/controller http://example.com/controller /action http://example.com/controller /action /key /value File System Layout application/ controllers/ ErrorController.php IndexController.php models/ views/ scripts/ error/ error.phtml index/ index.phtml helpers/ filters/ html/ .htaccess index.php library/ Zend/ html/ Your web server's document root. Contains the bootstrap file which all requests are routed through. Contains the .htaccess file which uses mod_rewrite to make sure all requests are rewritten to your bootstrap file. You can use regex so that requests for static files (e.g. js, ico, gif, jpg, png, css) are not rewritten to your bootstrap file. html/.htaccess RewriteEngine on RewriteRule !\.(js|ico|gif|jpg|png|css)$ index.php php_value include_path /library php_flag register_globals off php_value error_reporting 2047 php_flag display_errors on html/index.php (bootstrap file) <?php require_once 'Zend/Controller/Front.php'; Zend_Controller_Front::run(' /application/controllers'); [...]... My first Zend Framework App Hello, World! application/controllers/ ErrorController.php

Ngày đăng: 23/05/2014, 19:41

w