Home  >  Article  >  PHP Framework  >  Is Yii following the MVC pattern?

Is Yii following the MVC pattern?

Guanhui
GuanhuiOriginal
2020-06-08 11:42:062677browse

Is Yii following the MVC pattern?

#Is Yii an MVC pattern?

Yii is an MVC model. You can see from the directory structure and code of Yii that Yii adopts the MVC model. Yii is a high-performance component-based PHP framework used to develop large-scale Web applications. It is written in strict OOP, with complete library references and comprehensive tutorials.

Yii general directory structure

testdrive/
   index.php                 Web 应用入口脚本文件
   assets/                   包含公开的资源文件
   css/                      包含 CSS 文件
   images/                   包含图片文件
   themes/                   包含应用主题
   protected/                包含受保护的应用文件
      yiic                   yiic 命令行脚本
      yiic.bat               Windows 下的 yiic 命令行脚本
      commands/              包含自定义的 'yiic' 命令
         shell/              包含自定义的 'yiic shell' 命令
      components/            包含可重用的用户组件
         MainMenu.php        'MainMenu' 挂件类
         Identity.php        用来认证的 'Identity' 类
         views/              包含挂件的视图文件
            mainMenu.php     'MainMenu' 挂件的视图文件
      config/                包含配置文件
         console.php         控制台应用配置
         main.php            Web 应用配置
      controllers/           包含控制器的类文件
         SiteController.php  默认控制器的类文件
      extensions/            包含第三方扩展
      messages/              包含翻译过的消息
      models/                包含模型的类文件
         LoginForm.php       'login' 动作的表单模型
         ContactForm.php     'contact' 动作的表单模型
      runtime/               包含临时生成的文件
      views/                 包含控制器的视图和布局文件
         layouts/            包含布局视图文件
            main.php         所有视图的默认布局
         site/               包含 'site' 控制器的视图文件
            contact.php      'contact' 动作的视图
            index.php        'index' 动作的视图
            login.php        'login' 动作的视图
         system/             包含系统视图文件

Recommended tutorial: "PHP Tutorial"《YiiTutorial

The above is the detailed content of Is Yii following the MVC pattern?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn