首页 技术 正文
技术 2022年11月12日
0 收藏 336 点赞 4,943 浏览 2033 个字

Zend Framework学习日记(1)–环境搭建篇

(1)开发工具

Zend Framework框架:http://framework.zend.com/download/latest

包含2个目录bin和library,bin目录里面有zf命令行工具(包括Windows和Mac OS X平台),而library目录就是Zend Framework的各种组件放置的地方,可以复制该目录到PHP工程下,方便IDE可以查找到Zend Framework相关文件,以免报错。

Zend Studio 8:http://www.zendstudio.net/zend-studio-all-in-one-download/

基于Eclipse的PHP开发环境。

Zend Framework手册:http://framework.zend.com/docs/translations

提供离线html格式manual手册,有简体中文,不过很多还没有翻译。(另外,http://code.google.com/p/zfchm/downloads/list提供chm格式)

(2)zf命令行工具的使用

zf依赖于php命令解释器,因此要使用zf工具,需要把PHP安装目录(包含php.exe的目录)加入到Path环境变量中(建立过Java环境变量的童鞋应该知道怎么做),然后再把Zend Framework框架解压后的bin目录加入到Path环境变量。打开CMD,输入zf show version,应该就会出现zf的版本。如下

  1. C:/>zf show version
  2. Zend Framework Version: 1.11.5

注意:library目录不要移动,library目录必须和bin目录同级(默认就可以了。另外提醒,bin目录位置移动了,就需要修改它的Path环境变量),这样zf工具才能找到Zend Framework,否则会出现错误,如下

  1. ***************************** ZF ERROR ********************************
  2. In order to run the zf command, you need to ensure that Zend Framework
  3. is inside your include_path.  There are a variety of ways that you can
  4. ensure that this zf command line tool knows where the Zend Framework
  5. library is on your system, but not all of them can be described here.
  6. The easiest way to get the zf command running is to give it the include
  7. path via an environment variable ZEND_TOOL_INCLUDE_PATH or
  8. ZEND_TOOL_INCLUDE_PATH_PREPEND with the proper include path to use,
  9. then run the command “zf –setup”.  This command is designed to create
  10. a storage location for your user, as well as create the zf.ini file
  11. that the zf command will consult in order to run properly on your
  12. system.
  13. ……
  14. ……

使用zf –help,可以查看所有zf命令的详细用法。

(3)PHP.ini的include_path配置

找到并打开PHP.ini,搜索“include_path”,找到“; Windows: “/path1;/path2″”(我用的是windows环境),取消下面一行include_path前面的分号,将include_path改成“.;{Zend Framework解压的目录}/library”。这样Zend Studio新建一个Zend Framework工程时,不必每次复制Zend Framework框架的library替换新建工程里的library目录。

(4)启用Apache的mod_rewrite
我用的是WampServer集成开发环境,因此开启mod_rewrite非常方便,如图,使rewrite_module打上勾即可。

或者直接修改httpd.conf文件,搜索“rewrite_module”,找到“#LoadModule rewrite_module modules/mod_rewrite.so”去掉前面的“#”,重启Apache生效。

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,492
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,907
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,740
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,495
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:8,132
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:5,295