install:
1.从yiiframework.com下载最新版本的yii-basic-app-2.0.5.tgz,放到网站根目录,mac上composer安装各种坑,弃用
2.localhost/basic/web 报错说没有key
3.去basic/config/web.php,修改 cookieValidationKey=>’abc’
4.重启apache,刷localhost/basic/web,搞定!
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
routing:
1.basic/controllers/SiteController.php
add a function actionTest(){
$ttt=”aha68.com”;
$this->rend(‘newpage’,array(‘params’=>$ttt));
}

2.basic/views/site,add a newpage.php
//相当于

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
controller:
1.basic/controllers/目录下新增一个UsersController.php
[code]
<?php
namespace app\controllers;
use yii\web\Controller;
//use app\models\Users;
class UsersController extends Controller
{
public function actionIndex()
{
echo "test";
}
}
?>
[/code]
2.访问 localhost/yii/basic/web/index.php?r=users/index
看到 test
这个可以用来输出api,yeah!