利用Yii写了一个Hello World.

log date: 2012.4.25

前提条件:已经安装好了xmapp和yii


>>>Example of hello world:<<<


0. 修改C:\xampp\apache\conf\httpd-xampp.conf

 加入以下内容
    Alias /yii "C:/xampp/yii/"
   
        AllowOverride AuthConfig
   

 修改以下语句,加入yii
    


1. 生成web项目目录
C:\xampp\yii> .\framework\yiic webapp power

2.生成程序
C:\xampp\yii\power> ..\framework\yiic shell
>> controller message helloWorld

3. 编辑程序文件

Edit the file protected/views/message/helloWorld.php
so that it contains just thefollowing code:

$this->breadcrumbs=array(
    'Message'=>array('message/index'),
    'HelloWorld',
);?>

Hello, World!





Edit the file protected/controllers/MessageController.php
add the following two lines to function actionHelloWorld()
and remove the old one:

$theTime = date("D M j G:i:s T Y");
$this->render('helloWorld',array('time'=>$theTime));

4. you can visit:
http://localhost/yii/power/index.php?r=message/helloWorld

>>> End of hello world <<<


你可能感兴趣的:(利用Yii写了一个Hello World.)