Chinaunix首页 | 论坛 | 博客
  • 博客访问: 711218
  • 博文数量: 160
  • 博客积分: 8847
  • 博客等级: 中将
  • 技术积分: 1656
  • 用 户 组: 普通用户
  • 注册时间: 2010-11-25 16:46
个人简介

。。。。。。。。。。。。。。。。。。。。。。

文章分类

全部博文(160)

文章存档

2015年(1)

2013年(1)

2012年(4)

2011年(26)

2010年(14)

2009年(36)

2008年(38)

2007年(39)

2006年(1)

分类:

2009-05-30 00:59:00


第一次使用YII,YII完全是OOP的,性能、安全性都比别的PHP框架要好(YII官网有比较)。



YII的特征:

Yii comes with a full stack of features needed by today's Web 2.0 application development. Below is a short list of these features.

  • Model-View-Controller (MVC) design pattern: Yii adopts this proven technique in Web programming which can better separate logic from presentation.
完全的MVC设计
  • Database Access Objects (DAO) and Active Record: Yii allows developers to model database data in terms of objects and save their effort of writing long and repetitive SQL statements.
数据库访问对象和活动记录
  • Integration with jQuery: as one of the most popular JavaScript framework, jQuery enables writing highly efficient and versatile JavaScript interfaces.
内建Jquery支持
  • Form input and validation: Yii makes collecting form input extremely easy and safe. Yii comes with a set of validators which can be used to ensure validity of input data, and it also has helper methods and widgets to indicate errors when validation fails.
表达元素的检查
  • Web 2.0 widgets: powered by jQuery, Yii comes with a set of Web 2.0 widgets, such as auto-complete input field, treeview, and so on.
web2.0支持
  • Authentication and authorization: Yii has built-in authentication support. It also supports authorization via hierarchical role-based access control (RBAC).
内建认证支持
  • Theming: it enables change of the outlook of an Yii application instantly.
主题
  • Web services: Yii supports automatic generation of complex WSDL service specifications and management of Web service request handling.
web service支持
  • Internationalization (I18N) and localization (L10N): Yii supports message translation, date and time formatting, number formatting, and interface localization.
国际化
  • Layered caching scheme: Yii supports data caching, page caching, fragment caching and dynamic content. The storage medium of caching can be changed easily without touching the application code.
缓存
  • Error handling and logging: errors are handled and presented more nicely, and log messages can be categorized, filtered and routed to different destinations.
错误处理和日志
  • Security: Yii is equipped with many security measures to help secure Web applications to prevent cyber attacks. These measures include cross-site scripting (XSS) prevention, cross-site request forgery (CSRF) prevention, cookie tampering prevention, etc.
安全
  • Compliance to XHTML: Code generated by Yii components and command line tools complies to the XHTML standard.
服从XHTML
  • Automatic code generation: Yii provides the tools that can automatically generate the code that you need, such as a skeleton application, CRUD applications, etc.
自动代码生成
  • Purely object-oriented: Yii framework sticks to strict OOP paradigm. It does not define any global function or variable. And the class hierarchy that it defines allows maximum reusability and customization.
纯面向对象
  • Friendly with third-party code: Yii is carefully designed to work well with third-party code. For example, you can use code from PEAR or Zend Framework in your Yii application.
友好的第三方代码支持
  • Detailed documentation: every single method or property is clearly documented. A comprehensive tutorial is also provided together with other minor tutorials.
详细文档
  • Extension library: Yii provides an extension library consisting of user-contributed components. This makes the above feature list never ending.
扩展库

一、下载:
svn

注意,YII需要一定的系统环境。
测试环境地址:


如下图:

php.ini文件需要打开一部分动态链接库、以便满足YII的运行。


二、创建第一个应用程序:

1)E:\AppServ\www>dir
 Volume in drive E is Study
 Volume Serial Number is F42A-75EA

 Directory of E:\AppServ\www

2009-04-21  01:53              .
2009-04-21  01:53              ..
2009-04-18  19:51              .metadata
2009-04-08  02:11              appserv
2009-04-21  01:54              blog
2009-04-08  02:11              cgi-bin
2008-05-08  18:52             4,676 index.php
2009-04-18  19:43              myproject
2005-06-13  10:19                18 phpinfo.php
2009-04-08  02:11              phpMyAdmin
2009-05-29  23:16              YII
               2 File(s)          4,694 bytes
               9 Dir(s)  96,134,774,784 bytes free

2)
E:\AppServ\www>E:\AppServ\www\YII\framework\yiic webapp center
Create a Web application under 'E:\AppServ\www\center'? [Yes|No] y
      mkdir E:/AppServ/www/center
      mkdir E:/AppServ/www/center/assets
   generate assets/.yii
      mkdir E:/AppServ/www/center/css
   generate css/bg.gif
   generate css/form.css
   generate css/main.css
      mkdir E:/AppServ/www/center/images
   generate images/.yii
   generate index.php
      mkdir E:/AppServ/www/center/protected
   generate protected/.htaccess
      mkdir E:/AppServ/www/center/protected/commands
      mkdir E:/AppServ/www/center/protected/commands/shell
   generate protected/commands/shell/.yii
      mkdir E:/AppServ/www/center/protected/components
   generate protected/components/MainMenu.php
   generate protected/components/UserIdentity.php
      mkdir E:/AppServ/www/center/protected/components/views
   generate protected/components/views/mainMenu.php
      mkdir E:/AppServ/www/center/protected/config
   generate protected/config/console.php
   generate protected/config/main.php
      mkdir E:/AppServ/www/center/protected/controllers
   generate protected/controllers/SiteController.php
      mkdir E:/AppServ/www/center/protected/extensions
   generate protected/extensions/.yii
      mkdir E:/AppServ/www/center/protected/messages
   generate protected/messages/.yii
      mkdir E:/AppServ/www/center/protected/models
   generate protected/models/ContactForm.php
   generate protected/models/LoginForm.php
      mkdir E:/AppServ/www/center/protected/runtime
   generate protected/runtime/.yii
      mkdir E:/AppServ/www/center/protected/views
      mkdir E:/AppServ/www/center/protected/views/layouts
   generate protected/views/layouts/main.php
      mkdir E:/AppServ/www/center/protected/views/site
   generate protected/views/site/contact.php
   generate protected/views/site/index.php
   generate protected/views/site/login.php
      mkdir E:/AppServ/www/center/protected/views/system
   generate protected/views/system/.yii
   generate protected/yiic
   generate protected/yiic.bat
   generate protected/yiic.php
      mkdir E:/AppServ/www/center/themes
      mkdir E:/AppServ/www/center/themes/classic
      mkdir E:/AppServ/www/center/themes/classic/views
   generate themes/classic/views/.htaccess
      mkdir E:/AppServ/www/center/themes/classic/views/layouts
   generate themes/classic/views/layouts/.yii
      mkdir E:/AppServ/www/center/themes/classic/views/site
   generate themes/classic/views/site/.yii
      mkdir E:/AppServ/www/center/themes/classic/views/system
   generate themes/classic/views/system/.yii

Your application has been created successfully under E:\AppServ\www\center.

E:\AppServ\www>

3)预览


php.ini下载

文件:php.zip
大小:15KB
下载:下载


阅读(4016) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~