PHP--Yii框架之快速建立web应用骨架_PHP教程
时间:2021-07-01 10:21:17
帮助过:23人阅读
Basically, Yii(读音: 易, Yes it is的缩写)是个高性能PHP框架, 用来开发web 2.0应用。 用官网的话说叫快速, 安全, 专业。
在开始之前, 环境需要准备好。 具体点, 需要安装PHP。 为了能开发基于DB的web应用, MySQL也需要安装。 我的本地环境安装了EasyPHP5.3(包含了web服务器, PHP, MySQL)。 同时本地也安装有独立的PHP5.4。 具体环境搭建一搜索一堆, 这里略过。
要想快速建立一个web应用, 只需执行一个命令:
以下是命令输出信息:
Create a Web application under 'C:\Progs\EasyPHP-5.3.9\www\testdrive'? (yes|no) [no]:y
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/assets
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/css
generate css/bg.gif
generate css/form.css
generate css/ie.css
generate css/main.css
generate css/print.css
generate css/screen.css
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/images
generate index-test.php
generate index.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected
generate protected/.htaccess
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/commands
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/commands/shell
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/components
generate protected/components/Controller.php
generate protected/components/UserIdentity.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/config
generate protected/config/console.php
generate protected/config/main.php
generate protected/config/test.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/controllers
generate protected/controllers/SiteController.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/data
generate protected/data/schema.mysql.sql
generate protected/data/schema.sqlite.sql
generate protected/data/testdrive.db
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/extensions
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/messages
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/migrations
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/models
generate protected/models/ContactForm.php
generate protected/models/LoginForm.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/runtime
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/tests
generate protected/tests/bootstrap.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/tests/fixtures
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/tests/functional
generate protected/tests/functional/SiteTest.php
generate protected/tests/phpunit.xml
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/tests/report
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/tests/unit
generate protected/tests/WebTestCase.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/views
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/views/layouts
generate protected/views/layouts/column1.php
generate protected/views/layouts/column2.php
generate protected/views/layouts/main.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/views/site
generate protected/views/site/contact.php
generate protected/views/site/error.php
generate protected/views/site/index.php
generate protected/views/site/login.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/protected/views/site/pages
generate protected/views/site/pages/about.php
generate protected/yiic
generate protected/yiic.bat
generate protected/yiic.php
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/themes
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/themes/classic
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/themes/classic/views
generate themes/classic/views/.htaccess
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/themes/classic/views/layouts
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/themes/classic/views/site
mkdir C:/Progs/EasyPHP-5.3.9/www/testdrive/themes/classic/views/system
Your application has been created successfully under C:\Progs\EasyPHP-5.3.9\www\testdrive.
其实到这里, 应用已经建立完了。 下面启动EasyPHP测试刚刚建立的应用, 看看是神马样子滴
猛然间让我想起来Rails框架, 也是一个命令一个应用就出来了。 第一感觉凉爽.. 有继续下去的勇气了, 嘿嘿。 看看除了Home页面还生成了啥: