现在的位置: 首页 > 综合 > 正文

YII Framework学习教程-YII目录结构-2011-11-11

2013年04月26日 ⁄ 综合 ⁄ 共 6222字 ⁄ 字号 评论关闭

官方文档,

http://www.yiiframework.com/doc/guide/1.1/zh_cn/basics.convention

中文版

Yii 假定了一系列默认的目录用于不同的场合。如果需要,每个目录都可以自定义。

  • WebRoot/protected

    这是 应用基础目录
    是放置所有安全敏感的PHP脚本和数据文件的地方。Yii 有一个默认的 application 别名指向此目录。
    此目录及目录中的文件应该保护起来防止Web用户访问。它可以通过 CWebApplication::basePath 自定义。

  • WebRoot/protected/runtime

    此目录放置应用在运行时产生的私有临时文件。 此目录必须对 Web 服务器进程可写。它可以通过 CApplication::runtimePath自定义。

  • WebRoot/protected/extensions

    此目录放置所有第三方扩展。 它可以通过 CApplication::extensionPath自定义。

  • WebRoot/protected/modules:

     此目录放置所有的应用 模块,每个模块使用一个子目录。

  • WebRoot/protected/controllers:

     此目录放置所有控制器类文件。 它可以通过CWebApplication::controllerPath 自定义。

  • WebRoot/protected/views

    此目录放置所有试图文件, 包含控制器视图,布局视图和系统视图。 它可以通过 CWebApplication::viewPath 自定义。

  • WebRoot/protected/views/ControllerID

    此目录放置单个控制器类中使用的视图文件。 此处的ControllerID 是指控制器的
    ID 。它可以通过 CController::viewPath 自定义。

  • WebRoot/protected/views/layouts:

     此目录放置所有布局视图文件。它可以通过CWebApplication::layoutPath 自定义。

  • WebRoot/protected/views/system:

     此目录放置所有系统视图文件。 系统视图文件是用于显示异常和错误的模板。它可以通过 CWebApplication::systemViewPath 自定义。

  • WebRoot/assets

    此目录放置公共资源文件。 资源文件是可以被发布的,可由Web用户访问的私有文件。此目录必须对 Web 服务器进程可写。 它可以通过 CAssetManager::basePath 自定义

  • WebRoot/themes

    此目录放置应用使用的不同的主题。每个子目录即一个主题,主题的名字即目录的名字。 它可以通过 CThemeManager::basePath 自定义。

testwebap的目录结构,以后的文档可能用到。大体预览一下。

├── assets
│   ├── 477ed7f4
│   ├── 6f2a3a1a
│   └── 916d6077
├── css
│   ├── bg.gif
│   ├── form.css
│   ├── ie.css
│   ├── main.css
│   ├── print.css
│   └── screen.css
├── images
├── index.php
├── index-test.php
├── protected
│   ├── commands
│   ├── components
│   ├── config
│   ├── controllers
│   ├── data
│   ├── extensions
│   ├── messages
│   ├── migrations
│   ├── models
│   ├── modules
│   ├── runtime
│   ├── tests
│   ├── views
│   ├── yiic
│   ├── yiic.bat
│   └── yiic.php
└── themes
    └── classic

/www/yii_dev/testwebap# tree

.
├── assets
│   ├── 477ed7f4
│   │   ├── autocomplete
│   │   │   ├── indicator.gif
│   │   │   └── jquery.autocomplete.css
│   │   ├── jquery.ajaxqueue.js
│   │   ├── jquery.autocomplete.js
│   │   ├── jquery.ba-bbq.js
│   │   ├── jquery.bgiframe.js
│   │   ├── jquery.cookie.js
│   │   ├── jquery.js
│   │   ├── jquery.maskedinput.js
│   │   ├── jquery.metadata.js
│   │   ├── jquery.min.js
│   │   ├── jquery.multifile.js
│   │   ├── jquery.rating.js
│   │   ├── jquery.treeview.async.js
│   │   ├── jquery.treeview.edit.js
│   │   ├── jquery.treeview.js
│   │   ├── jquery.yiiactiveform.js
│   │   ├── jquery.yii.js
│   │   ├── jquery.yiitab.js
│   │   ├── jui
│   │   │   ├── css
│   │   │   │   └── base
│   │   │   │       ├── images
│   │   │   │       │   ├── ui-bg_flat_0_aaaaaa_40x100.png
│   │   │   │       │   ├── ui-bg_flat_75_ffffff_40x100.png
│   │   │   │       │   ├── ui-bg_glass_55_fbf9ee_1x400.png
│   │   │   │       │   ├── ui-bg_glass_65_ffffff_1x400.png
│   │   │   │       │   ├── ui-bg_glass_75_dadada_1x400.png
│   │   │   │       │   ├── ui-bg_glass_75_e6e6e6_1x400.png
│   │   │   │       │   ├── ui-bg_glass_95_fef1ec_1x400.png
│   │   │   │       │   ├── ui-bg_highlight-soft_75_cccccc_1x100.png
│   │   │   │       │   ├── ui-icons_222222_256x240.png
│   │   │   │       │   ├── ui-icons_2e83ff_256x240.png
│   │   │   │       │   ├── ui-icons_454545_256x240.png
│   │   │   │       │   ├── ui-icons_888888_256x240.png
│   │   │   │       │   └── ui-icons_cd0a0a_256x240.png
│   │   │   │       ├── jquery.ui.accordion.css
│   │   │   │       ├── jquery.ui.all.css
│   │   │   │       ├── jquery.ui.autocomplete.css
│   │   │   │       ├── jquery.ui.base.css
│   │   │   │       ├── jquery.ui.button.css
│   │   │   │       ├── jquery.ui.core.css
│   │   │   │       ├── jquery-ui.css
│   │   │   │       ├── jquery.ui.datepicker.css
│   │   │   │       ├── jquery.ui.dialog.css
│   │   │   │       ├── jquery.ui.progressbar.css
│   │   │   │       ├── jquery.ui.resizable.css
│   │   │   │       ├── jquery.ui.selectable.css
│   │   │   │       ├── jquery.ui.slider.css
│   │   │   │       ├── jquery.ui.tabs.css
│   │   │   │       └── jquery.ui.theme.css
│   │   │   ├── js
│   │   │   │   ├── jquery-ui-i18n.min.js
│   │   │   │   └── jquery-ui.min.js
│   │   │   └── MIT-LICENSE.txt
│   │   ├── rating
│   │   │   ├── delete.gif
│   │   │   ├── jquery.rating.css
│   │   │   └── star.gif
│   │   ├── treeview
│   │   │   ├── images
│   │   │   │   ├── ajax-loader.gif
│   │   │   │   ├── file.gif
│   │   │   │   ├── folder-closed.gif
│   │   │   │   ├── folder.gif
│   │   │   │   ├── minus.gif
│   │   │   │   ├── plus.gif
│   │   │   │   ├── treeview-black.gif
│   │   │   │   ├── treeview-black-line.gif
│   │   │   │   ├── treeview-default.gif
│   │   │   │   ├── treeview-default-line.gif
│   │   │   │   ├── treeview-famfamfam.gif
│   │   │   │   ├── treeview-famfamfam-line.gif
│   │   │   │   ├── treeview-gray.gif
│   │   │   │   ├── treeview-gray-line.gif
│   │   │   │   ├── treeview-red.gif
│   │   │   │   └── treeview-red-line.gif
│   │   │   └── jquery.treeview.css
│   │   └── yiitab
│   │       └── jquery.yiitab.css
│   ├── 6f2a3a1a
│   │   └── pager.css
│   └── 916d6077
│       ├── detailview
│       │   └── styles.css
│       ├── gridview
│       │   ├── bg.gif
│       │   ├── delete.png
│       │   ├── down.gif
│       │   ├── jquery.yiigridview.js
│       │   ├── loading.gif
│       │   ├── styles.css
│       │   ├── update.png
│       │   ├── up.gif
│       │   └── view.png
│       └── listview
│           ├── down.gif
│           ├── jquery.yiilistview.js
│           ├── loading.gif
│           ├── styles.css
│           └── up.gif
├── css
│   ├── bg.gif
│   ├── form.css
│   ├── ie.css
│   ├── main.css
│   ├── print.css
│   └── screen.css
├── images
├── index.php
├── index-test.php
├── protected
│   ├── commands
│   │   ├── shell
│   │   ├── TestCommand.php
│   │   └── TestCommand.php~
│   ├── components
│   │   ├── Controller.php
│   │   └── UserIdentity.php
│   ├── config
│   │   ├── console.php
│   │   ├── console.php~
│   │   ├── main.php
│   │   ├── main.php~
│   │   └── test.php
│   ├── controllers
│   │   ├── SiteController.php
│   │   ├── TestController.php
│   │   └── UserController.php
│   ├── data
│   │   ├── schema.mysql.sql
│   │   ├── schema.sqlite.sql
│   │   └── testdrive.db
│   ├── extensions
│   ├── messages
│   │   ├── config.php
│   │   └── zh_cn
│   │       ├── login_message.php
│   │       └── login_message.php~
│   ├── migrations
│   ├── models
│   │   ├── ContactForm.php
│   │   ├── LoginForm.php
│   │   └── User.php
│   ├── modules
│   │   └── testmod
│   │       ├── components
│   │       ├── controllers
│   │       │   └── DefaultController.php
│   │       ├── messages
│   │       ├── models
│   │       ├── TestmodModule.php
│   │       └── views
│   │           ├── default
│   │           │   ├── index.php
│   │           │   └── index.php~
│   │           └── layouts
│   ├── runtime
│   │   └── application.log
│   ├── tests
│   │   ├── bootstrap.php
│   │   ├── fixtures
│   │   │   └── tbl_user.php
│   │   ├── functional
│   │   │   ├── SiteTest.php
│   │   │   └── UserTest.php
│   │   ├── phpunit.xml
│   │   ├── report
│   │   ├── unit
│   │   │   └── UserTest.php
│   │   └── WebTestCase.php
│   ├── views
│   │   ├── layouts
│   │   │   ├── column1.php
│   │   │   ├── column2.php
│   │   │   ├── main.php
│   │   │   └── main.php~
│   │   ├── site
│   │   │   ├── contact.php
│   │   │   ├── error.php
│   │   │   ├── index.php
│   │   │   ├── login.php
│   │   │   └── pages
│   │   │       └── about.php
│   │   ├── test
│   │   │   ├── action1.php
│   │   │   ├── action2.php
│   │   │   ├── action3.php
│   │   │   └── index.php
│   │   └── user
│   │       ├── admin.php
│   │       ├── create.php
│   │       ├── _form.php
│   │       ├── index.php
│   │       ├── _search.php
│   │       ├── update.php
│   │       ├── userformtest.php
│   │       ├── _view.php
│   │       └── view.php
│   ├── yiic
│   ├── yiic.bat
│   └── yiic.php
└── themes
    └── classic
        └── views
            ├── layouts
            ├── site
            └── system

58 directories, 153 files

【上篇】
【下篇】

抱歉!评论已关闭.