042010

Window7 xampp下zend framework 1.10.7 quickstart、配置与调试

Category: Zend Frameworklixiphp @ 9:37 下午

you can » Download the latest version of Zend Framework and extract the contents; make a note of where you have done so.

Create Your Project

  • zf Command Line Tool的安装

第一步:首先环境变量设置,在系统变量一栏找到Path变量,编辑,添加

D:\xampp\php;D:\xampp\htdocs\ZendFramework-1.10.7\bin

我这里安装的xampp,自己的安装目录不同,请自行更改

第二步:检测安装,开始-》运行(或者直接win+R键) –》 输入cmd -》输入一下命令

C:\Users\bruce>php -version
PHP 5.2.6 (cli) (built: May  2 2008 18:02:07)
Copyright (c) 1997-2008 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2008 Zend Technologies
    with Zend Extension Manager v1.2.0, Copyright (c) 2003-2007, by Zend Technologies
    with Zend Optimizer v3.3.3, Copyright (c) 1998-2007, by Zend Technologies

如果出现你的php版本,说明你的php命令环境安装成功!

C:\Users\bruce>zf ? version
Zend Framework Command Line Console Tool v1.10.7
Actions supported by provider "Version"
  Version
    zf show version mode[=mini] name-included[=1]
    Note: There are specialties, use zf show version.? to get specific help on them.

如果出现你的Zend Framework信息,说明你的Zend Framework Command Line Console Tool 环境安装成功!

  • Command 完成工程的建立

cd D:\xampp\htdocs\ZendFramework-1.10.7

进入安装project的虚拟目录,接着:

D:\xampp\htdocs\ZendFramework-1.10.7>zf create project quickstart
Creating project at D:/xampp/htdocs/ZendFramework-1.10.7/quickstart
Note: This command created a web project, for more information setting up your VHOST, please see docs/README

提示project已经建立到quickstart目录中,Command提示VHOST安装的信息,我们的xampp已经完成了。

Running this command will create your basic site structure, including your initial controllers and views. The tree looks like the following:

D:\XAMPP\HTDOCS\ZENDFRAMEWORK-1.10.7\QUICKSTART
├─application
│  ├─configs
│  ├─controllers
│  ├─models
│  └─views
│      ├─helpers
│      └─scripts
│          ├─error
│          └─index
├─docs
├─library
├─public
└─tests
    ├─application
    └─library

copying ZendFramework-1.10.7\library 到 your quickstart\library/ directory.

访问http://127.0.0.1/ZendFramework-1.10.7/quickstart/public/index.php

你会看到以下图片:

image-Welcome to the Zend Framework!


quickstart程序

  • 引导类 Bootstrap

Your Bootstrap class defines what resources and components to initialize. By default, Zend Framework’s Front Controller is initialized, and it uses the application/controllers/ as the default directory in which to look for action controllers (more on that later). The class looks like the following:

<?php
class Bootstrap extends Zend_Application_Bootstrap_Bootstrap
{
}

  • ini 配置问题 Configuration

默认的配置文件放在application/configs/application.ini,It looks as follows:

[production]
phpSettings.display_startup_errors = 0
phpSettings.display_errors = 0
includePaths.library = APPLICATION_PATH "/../library"
bootstrap.path = APPLICATION_PATH "/Bootstrap.php"
bootstrap.class = "Bootstrap"
appnamespace = "Application"
resources.frontController.controllerDirectory = APPLICATION_PATH "/controllers"
resources.frontController.params.displayExceptions = 0

[staging : production]

[testing : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1

[development : production]
phpSettings.display_startup_errors = 1
phpSettings.display_errors = 1
resources.frontController.params.displayExceptions = 1

配置文件参照php.ini文件,主要分为四个部分:production, staging, testing, and development 这是一般项目的开发周期,不过一般我们就直接进入production阶段。关于每个变量的解释请查看其他相关手册。

  • MVC model-controller-view

controllers models views三个目录就是我们耳濡目染的MVS设计模式,具体的解释没有,请查看相关文档。

注意:view里面还有一个layout的功能

结束语

  • 本文主要参照zend framework 最新官方的quickstart文档编写,关于深入开发请到官方下载手册和API。
  • 本文编写时间匆忙,只是一些肤浅教程,希望读者指正!
声明:本站遵循署名-非商业性使用-相同方式共享 3.0共享协议. 转载请注明转自LixiPHP

标签: , , , , , , ,

相关信息

  • 推荐网址:

  • 收藏+分享: Del.icio.us Google书签 Digg Live Bookmark Technorati Furl Yahoo书签 Facebook 百度搜藏 新浪ViVi 365Key网摘 天极网摘 和讯网摘 博拉网 POCO网摘 添加到饭否 QQ书签 Digbuzz我挖网

欢迎写下您的评论,其中 * 为必填项目

这里写下你想说的话

 wink neutral mad twisted :) eek sad rolleyes razz redface surprised mrgreen lol idea biggrin evil cry cool arrow confused question exclaim