yii学习笔记

主要参考地址http://www.yiiframework.com/doc/guide/1.1/zh_cn/

安装

1 首先是创建一个yii application

YiiRoot/framework/yiic webapp WebRoot/guavayii

2 复制framework到刚刚创建的application里面 之后把index.php的第4 5行改为 $yii=dirname(__FILE__).'/framework/yii.php';

$config=dirname(__FILE__).'/protected/config/main.php';

3 输入相应的地址就可以访问了

 

控制器

1 copy一份protected\controllers\SiteController.php 到 GuavaController.php

 

class GuavaController extends Controller
{
	/**
	 * This is the default 'index' action that is invoked
	 * when an action is not explicitly requested by users.
	 */

	 //相关文档 http://www.yiiframework.com/doc/guide/1.1/zh_cn/basics.controller
	public function actionIndex($gu)
	public function actionIndex($gu,$language='en')
	{
		//$this->render('index');
		echo $gu.$language;
		echo "hello yii";
	}
}

访问http://127.0.0.1/guavayii/index.php?r=guava&gu=1&language=zh 就可以看到 1zhhello yii 

你可能感兴趣的:(PHP)