SlideShare a Scribd company logo
Aaron Huang
先聲明一件事
現在沒寫 PHP 了
...
投資有賺有賠,使用前請先詳閱公開說明書
Aaron Huang

•   Software Engineer @ Waveface

•   PHP , JavaScript , CoffeeScript , Python ...etc

•   github, twitter : @aar0ntw

•   plurk : @smoraa

•   Blog: http://blog.buginception.com
Slide


http://goo.gl/yTXv6
Live Demo
再讓我   一些別的
PHP Framework
五花八門,用的順手就好
為什麼要用 framework
PHP 很難寫
寫的好不容易
市場上每個人都說會寫
那為什麼還要用 PHP
那為什麼還要用 PHP

• 門檻低
那為什麼還要用 PHP

• 門檻低
• 好上手
那為什麼還要用 PHP

• 門檻低
• 好上手
• 誰都會寫(?)
那為什麼還要用 PHP

• 門檻低
• 好上手
• 誰都會寫(?)
• 資源豐富
過去種種,罄竹難書
目的

• 推廣
• 介紹
• 入門
• Yii php framework tutorial
 •   Intro

 •   MVC pattern

 •   Http request life cycle in yii

 •   Folder Structure

 •   Tools

• live demo
• Q &A
官方資源



•   http://www.yiiframework.com

•   http://www.yiiframework.com/doc/api/1.1/

•   http://www.yiiframework.com/doc/guide/1.1/en/
簡介
Yii 是什麼
Yii 是什麼

• MVC 架構
Yii 是什麼

• MVC 架構
• 快速開發
Yii 是什麼

• MVC 架構
• 快速開發
• 高效率
@DHH
@DHH
Before finding Ruby, I spent about four years developing PHP web-applications
Yii


• 美籍華人 薛強   (@qiang1)



• Prado
No framework will last forever
Plain PHP Flow

index.php        about.php    page.php




access.php                     list.php




delete.php       update.php   create.php
Yii 程式流程
                                app
index.php      application
                             component




               controller




                 widget



 model                         view
MVC 模式
MVC 模式


• Model - View - Controller
MVC 模式


• Model - View - Controller
• 資料 - 畫面 - 中介控制
MVC 模式


• Model - View - Controller
• 資料 - 畫面 - 中介控制
• 商業邏輯 - 前端畫面 - 流程控管
Yii request 生命週期
index.php (Bootstrap)
                               app
  index.php   application
                            component




              controller




                widget



   model                      view
Yii::CWebApplication
                               app
  index.php   application
                            component




              controller




                widget



   model                      view
Yii::CComponent
                             app
index.php   application
                          component




            controller




              widget



 model                      view
Yii::CUrlManager
                                          app
index.php   application
                                       component

                          UrlManager



            controller




              widget



 model                                   view
Yii::CController
                             app
index.php   application
                          component




            controller




              widget



 model                      view
Yii::CActiveRecord
                              app
 index.php   application
                           component




             controller




               widget



  model                      view
CController::render
                               app
  index.php   application
                            component




              controller




                widget



   model                      view
Yii::CWidget
                             app
index.php   application
                          component




            controller




              widget



 model                      view
輔助工具
輔助工具



• yiic : command line tool
輔助工具



• yiic : command line tool
• Gii : Web UI tool
輔助工具 : CLI tool
輔助工具 : CLI tool

• yiic shell
輔助工具 : CLI tool

• yiic shell
 • model
輔助工具 : CLI tool

• yiic shell
 • model
 • controller
輔助工具 : CLI tool

• yiic shell
 • model
 • controller
 • crud
輔助工具 : CLI tool

• yiic shell
 • model
 • controller
 • crud
• yiic migrate
Q &A

More Related Content

Similar to phpconf 2012 yii

向jquery学习
向jquery学习向jquery学习
向jquery学习
jay li
 
大话Php之性能
大话Php之性能大话Php之性能
大话Php之性能
liqiang xu
 
2011 php技术高峰论坛演讲.黄波
2011 php技术高峰论坛演讲.黄波2011 php技术高峰论坛演讲.黄波
2011 php技术高峰论坛演讲.黄波leontb
 
系統整合
系統整合系統整合
系統整合麒 王
 
Continuous Delivery: automated testing, continuous integration and continuous...
Continuous Delivery: automated testing, continuous integration and continuous...Continuous Delivery: automated testing, continuous integration and continuous...
Continuous Delivery: automated testing, continuous integration and continuous...
Jimmy Lai
 
ASP.Net WebAPI經驗分享
ASP.Net WebAPI經驗分享ASP.Net WebAPI經驗分享
ASP.Net WebAPI經驗分享
國昭 張
 
咩星征服計劃 用 Js 征服地球 Part II
咩星征服計劃 用 Js 征服地球 Part II咩星征服計劃 用 Js 征服地球 Part II
咩星征服計劃 用 Js 征服地球 Part II
羊 小咩 (lamb-mei)
 
twMVC#01 | ASP.NET MVC 的第一次親密接觸
twMVC#01 | ASP.NET MVC 的第一次親密接觸twMVC#01 | ASP.NET MVC 的第一次親密接觸
twMVC#01 | ASP.NET MVC 的第一次親密接觸
twMVC
 
富文本编辑器在互联网上的应用
富文本编辑器在互联网上的应用富文本编辑器在互联网上的应用
富文本编辑器在互联网上的应用luolonghao
 
開放原始碼 Ch2.2 app - oss - google client api & app engine(ver 1.0)
開放原始碼 Ch2.2   app - oss -  google client api & app engine(ver 1.0)開放原始碼 Ch2.2   app - oss -  google client api & app engine(ver 1.0)
開放原始碼 Ch2.2 app - oss - google client api & app engine(ver 1.0)My own sweet home!
 
使用 Controller
使用 Controller使用 Controller
使用 Controller
Shengyou Fan
 
Introduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.xIntroduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.x
Bo-Yi Wu
 
Html01
Html01Html01
Html01
Ht Wang
 
twMVC#23 | 快速上手 Azure Functions
twMVC#23 | 快速上手 Azure FunctionstwMVC#23 | 快速上手 Azure Functions
twMVC#23 | 快速上手 Azure Functions
twMVC
 
学习 CodeIgniter
学习 CodeIgniter学习 CodeIgniter
学习 CodeIgniter
BruceWolf
 
KISSY Editor Design 2
KISSY Editor Design 2KISSY Editor Design 2
KISSY Editor Design 2
yiming he
 
Real World ASP.NET MVC
Real World ASP.NET MVCReal World ASP.NET MVC
Real World ASP.NET MVC
jeffz
 
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練32015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
Duran Hsieh
 
Continuous integration
Continuous integrationContinuous integration
Continuous integrationnetdbncku
 
使用 Controller
使用 Controller使用 Controller
使用 Controller
Shengyou Fan
 

Similar to phpconf 2012 yii (20)

向jquery学习
向jquery学习向jquery学习
向jquery学习
 
大话Php之性能
大话Php之性能大话Php之性能
大话Php之性能
 
2011 php技术高峰论坛演讲.黄波
2011 php技术高峰论坛演讲.黄波2011 php技术高峰论坛演讲.黄波
2011 php技术高峰论坛演讲.黄波
 
系統整合
系統整合系統整合
系統整合
 
Continuous Delivery: automated testing, continuous integration and continuous...
Continuous Delivery: automated testing, continuous integration and continuous...Continuous Delivery: automated testing, continuous integration and continuous...
Continuous Delivery: automated testing, continuous integration and continuous...
 
ASP.Net WebAPI經驗分享
ASP.Net WebAPI經驗分享ASP.Net WebAPI經驗分享
ASP.Net WebAPI經驗分享
 
咩星征服計劃 用 Js 征服地球 Part II
咩星征服計劃 用 Js 征服地球 Part II咩星征服計劃 用 Js 征服地球 Part II
咩星征服計劃 用 Js 征服地球 Part II
 
twMVC#01 | ASP.NET MVC 的第一次親密接觸
twMVC#01 | ASP.NET MVC 的第一次親密接觸twMVC#01 | ASP.NET MVC 的第一次親密接觸
twMVC#01 | ASP.NET MVC 的第一次親密接觸
 
富文本编辑器在互联网上的应用
富文本编辑器在互联网上的应用富文本编辑器在互联网上的应用
富文本编辑器在互联网上的应用
 
開放原始碼 Ch2.2 app - oss - google client api & app engine(ver 1.0)
開放原始碼 Ch2.2   app - oss -  google client api & app engine(ver 1.0)開放原始碼 Ch2.2   app - oss -  google client api & app engine(ver 1.0)
開放原始碼 Ch2.2 app - oss - google client api & app engine(ver 1.0)
 
使用 Controller
使用 Controller使用 Controller
使用 Controller
 
Introduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.xIntroduction to MVC of CodeIgniter 2.1.x
Introduction to MVC of CodeIgniter 2.1.x
 
Html01
Html01Html01
Html01
 
twMVC#23 | 快速上手 Azure Functions
twMVC#23 | 快速上手 Azure FunctionstwMVC#23 | 快速上手 Azure Functions
twMVC#23 | 快速上手 Azure Functions
 
学习 CodeIgniter
学习 CodeIgniter学习 CodeIgniter
学习 CodeIgniter
 
KISSY Editor Design 2
KISSY Editor Design 2KISSY Editor Design 2
KISSY Editor Design 2
 
Real World ASP.NET MVC
Real World ASP.NET MVCReal World ASP.NET MVC
Real World ASP.NET MVC
 
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練32015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
2015 年逢甲大學資訊系:ASP.NET MVC 4 教育訓練3
 
Continuous integration
Continuous integrationContinuous integration
Continuous integration
 
使用 Controller
使用 Controller使用 Controller
使用 Controller
 

More from Aaron Huang

Dollar symbol
Dollar symbolDollar symbol
Dollar symbol
Aaron Huang
 
Git branching-model
Git branching-modelGit branching-model
Git branching-model
Aaron Huang
 
Pomodoro
PomodoroPomodoro
Pomodoro
Aaron Huang
 
Apprenticeship Patterns
Apprenticeship PatternsApprenticeship Patterns
Apprenticeship Patterns
Aaron Huang
 
Readability
ReadabilityReadability
Readability
Aaron Huang
 

More from Aaron Huang (6)

Scrumban
ScrumbanScrumban
Scrumban
 
Dollar symbol
Dollar symbolDollar symbol
Dollar symbol
 
Git branching-model
Git branching-modelGit branching-model
Git branching-model
 
Pomodoro
PomodoroPomodoro
Pomodoro
 
Apprenticeship Patterns
Apprenticeship PatternsApprenticeship Patterns
Apprenticeship Patterns
 
Readability
ReadabilityReadability
Readability
 

phpconf 2012 yii

Editor's Notes

  1. \n
  2. \n
  3. \n
  4. \n
  5. \n
  6. \n
  7. \n
  8. \n
  9. \n
  10. \n
  11. \n
  12. \n
  13. \n
  14. \n
  15. \n
  16. \n
  17. \n
  18. \n
  19. \n
  20. \n
  21. \n
  22. \n
  23. \n
  24. \n
  25. \n
  26. \n
  27. \n
  28. \n
  29. \n
  30. \n
  31. \n
  32. \n
  33. \n
  34. \n
  35. \n
  36. \n
  37. \n
  38. \n
  39. \n
  40. \n
  41. \n
  42. \n
  43. \n
  44. \n
  45. \n
  46. \n
  47. \n
  48. \n
  49. \n
  50. \n
  51. \n
  52. \n
  53. \n
  54. \n