一.配置:
1.php.ini 开启PDO及PDO相关数据库引擎
extension=php_pdo_mysql.dll
2.http.conf 开启rewrite模块
2.1LoadModule rewrite_module modules/mod_rewrite.so
2.2 并识别.htaccess功能
Options FollowSymLinks AllowOverride ALL Order deny,allow Deny from all Satisfy all... # Options FileInfo AuthConfig Limit # AllowOverride ALL...# CGI directory exists, if you have that configured.# AllowOverride All Options None Order allow,deny Allow from all
3.配置虚拟主机 //虚拟主机配置非必要,麻烦...
3.1 http.conf
# Virtual hosts 启动虚拟主机的配置Include conf/extra/httpd-vhosts.conf
3.2 /apache/conf/extra/httpd-vhosts.conf
DocumentRoot "E://www/myweb.com/public" ServerName myweb.com Options FollowSymLinks AllowOverride None Order allow,deny Allow from all
在windows的host文件里面加上
127.0.0.1 myweb.com
配置错误日志
可以在php.ini设置
error_log="E:\www\php_errors.log" 能查看系统的错误日志
================================================================================
================================================================================创建项目
进入到Zend FrameWork源码包,在bin目录下使用 zf.bat 生成ZF工程 zf.bat create project (项目路径)
之后把源码包里面的library/Zend 复制到项目文件对应的library文件夹下
================================================================================
================================================================================数据库配置/application/configs/application.ini后面加上 注:不同写法的数据库配置文件,其数据库适配器书写也不一样,特注:数据库配置文件后面的说明不要带上
[mysql] //节名自己随意取db.adapter = PDO_MYSQL //请开启PDO扩展db.params.host = localhost //Mysql主机地址db.params.username = root //用户名db.params.password = root //密码db.params.dbname = ceshi //数据库
初始化数据库适配器
在 ./application/controllers/下 创建 BaseController.php 用于数据库连接的 父类db); $db->query('SET NAMES UTF8'); Zend_Db_Table::setDefaultAdapter($db); }}
数据库测试:
在./application/models/ 下创建 GoodsMod.php
./application/controllers/IndexController.php 修改为
fetchAll()->toArray(); echo ""; print_r($res); echo ""; exit; }}
================================================================================
================================================================================Digitalus CMS 这个开源模板适合学习 ZF digitalus_1.8 错误修改
date_default_timezone_set('Asia/Shanghai');