草庐IT

showComments

全部标签

php - 条件语句是否属于 php mvc 中的模型或 Controller ?

如果您正在使用mvc来构建用户配置文件,那么在模型或Controller中的函数中使用条件语句来计算评论的显示类型会更好吗:例如我有3个类(class)评论成员管理员(扩展成员)一些示例使用缺少函数的伪代码选项1根据返回评论的showComments函数中登录的用户类型,将返回不同的信息。classuser{functionisLoggedIn(){//Checkifauserisloggedin}functiongetUserType(){//returnusertype}functionshowComments($id){//commentscode}}classadminexte