利用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/"
    <Directory "C:/xampp/yii">
        AllowOverride AuthConfig
    </Directory>
 修改以下语句,加入yii
 <LocationMatch "^/(?i:(?:xampp|licenses|phpmyadmin|webalizer|server-status|server-info|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:

<?php
$this->breadcrumbs=array(
    'Message'=>array('message/index'),
    'HelloWorld',
);?>
<h1>Hello, World!</h1>
<h3><?php echo $time; ?></h3>


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 <<<


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值