dapeng 2013-02-20 11:31:52 7120次浏览 9条回复 8 4 0
$criteria = new CDbCriteria;
$criteria->select = array('ziduan"); 
$res = Model::model()->findAll($cirteria);

搜某一个字段

//当前域名 
echo Yii::app()->request->hostInfo; 
//当前URL
echo Yii::app()->request->getUrl();
//返回首页 
echo Yii::app()->user->returnUrl;

//提交后 防止重复提交
Ccontroler->refresh();

//上一页url  很有用哦
Yii::app()->request->urlReferrer;

//获取ip地址
Yii::app()->request->userHostAddress;

//yii execute后获取insert id 
$id = Yii::app()->db->getLastInsertID();

//yii获取get,post过来的数据 
Yii::app()->request->getParam('id');

//Yii->user(当前用户)相关 常用方法是
class Controller extends CController {
    public $user = null;
    $this->user = Yii:app()->user;
}
this->user->isGuest; 
this->user->id; 
this->user->name;
觉得很赞
您需要登录后才可以回复。登录 | 立即注册