免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2884 | 回复: 0

Zend Framework入门笔记 [复制链接]

论坛徽章:
0
发表于 2010-01-07 17:14 |显示全部楼层

               
在网上这方法的资料也很多,最近在学习ZF所以记录了一下自已学习步骤:
一. 下载开发工具:Zend Studio for Eclipse 6.0
    1)Zend 官方网站下载:http://downloads.zend.com/studio-eclipse/6.0.0/ZendStudioForEclipse-6_0_0.zip
    2)下载后,并安装好。
    3)注册码如下:
      用户名:PHPER
      注册码:4784D9D0086669570000
    4)启动开发工具桌面的快捷图标ZendStudio,选择菜单:Help-->Register...输入注册码确定完成。

二.须要配置的几个地方。
1. apache目录下的httpd.conf
     1)本机发布目录的设置如下:
       DocumentRoot "D:/jnt/work/php/test/html"
      
       。。。。。。。。。
      
     2)打开允许写的模块功能
       找到#LoadModule rewrite_module modules/mod_rewrite.so 这行并将前面的"#"去掉
     
     3)找开允许写操作功能
       找到AllowOverride none 改为AllowOverride all 才能使.htaccess文件起作用.
2. PHP的配置文件php.ini
     1) 设置lib的路径
      找到include_path="你的ZF路径"; 例如如下:
      include_path = ".;D:\jnt\work\php\test\library"
三. 进入开发ZF了。
   
1. 运行开发工具
2. 创建新工程先择菜单:File-->New-->Zend Framework Project 项目名为:test
     生成结构入下:

3.index.php是整个项目的控制中心。
    setControllerDirectory('../application/default/controllers');
$controller->throwExceptions(TRUE); // should be turned on in development time
// run!
$controller->dispatch();
?>
4.IndexController.php default默认控制器
_getParam('error_handler');
         switch ($errors->type) {
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_CONTROLLER:
             case Zend_Controller_Plugin_ErrorHandler::EXCEPTION_NO_ACTION:
                 // 404 error -- controller or action not found                 
                 $this->getResponse()->setRawHeader('HTTP/1.1 404 Not Found');
                 $this->view->title = 'HTTP/1.1 404 Not Found';
                 break;
             default:
                 // application error; display error page, but don't change                 
                 // status code
                 $this->view->title = 'Application Error';
                 break;
         }
         
         $this->view->message = $errors->exception;
     }
}
6.运行测试
http://域名/控制器名/动作方法名/
http://localhost:8088/index/index
http://localhost:8088/
结果如下就成功了。。。
Hello, World!
7.恭喜你简单的入门成功了。



Zend Framework手册:
http://www.phpeye.com/zf/index.html
http://hi.baidu.com/happyjnt/blog/item/258de82bc043fffce6cd4084.html


               
               
               
               
               

本文来自ChinaUnix博客,如果查看原文请点:http://blog.chinaunix.net/u2/88379/showart_2143294.html
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP