PHP 项目中的一些代码
//提交评论数据
function postaction($data){
if(!data){
$this->error('错误,请返回');
}
$cm = new CommentModel(C('T_USER_COMMENT'));
$value = $cm->create($data);
if(!$value){
$this->error($cm->getError());
}
if(empty($cm->uid)){
$cm->uid = 0;
}
if(isset($_POST['actiontype']) && $_POST['actiontype']=='add'){
if($cm->add()){
return $value;
}else{
return false;
}
}else if($_POST['actiontype']=='mod'){
if($cm->where("cid={$value->cid}")->save()){
return $value;
}else{
return false;
}
}else{
$this->error('操作错误');
}
}
页:
[1]