yii学习笔记(在控制器访问别的类方法)

在当前控制器定义一个actions的方法

public function actions()
{
	return array(
		//  
		'captcha'=>array(
			'class'=>'CCaptchaAction',
			'backColor'=>0xFFFFFF,
		),
		//  
		// 
		'page'=>array(
			'class'=>'CViewAction',
		),
	);
}

  

function actions(){
    return array(
        'captcha'=>array(
            'class'=>'system.web.widgets.captcha.CCaptchaAction',
            'width'=>75,
            'height'=>30,
        ),
        
        //我们在外边随便定义一个类,都可以通过这种方式访问
        // user/co 就会访问Computer.php里边的run()方法
        'co'=>array(
            'class'=>'application.controllers.Computer',
        ),
    );
}

  

posted @ 2014-08-05 11:40  自学it技术  阅读(167)  评论(0编辑  收藏  举报