YII类的映射表机制

<?php
/**
 * Created by PhpStorm.
 * Date: 2016/5/25
 * Time: 19:09
 *
 * YII的类的映射表
 */
namespace frontend\controllers;

use Yii;
use yii\web\Controller;
//use frontend\models\Post;  //作用被下面的classMap替换掉了
class HelloController extends Controller
{
    public function actionIndex()
    {
        \Yii::$classMap['ap\models\Post'] = 'D:\www\advanced\frontend\models\Post.php';

        $post = new Post();
    }
}

 

posted @ 2016-05-26 09:31  雨落知音  阅读(352)  评论(0编辑  收藏  举报