1.创建model /biaodan.php <?php /** * Created by PhpStorm. * User: moka同学 * Date: 2016/08/05 * Time: 10:26 */ namespace app\models; use Yii; use yii\base\Model; class Biaodan extends Model{ public $name; public $pass; public $email; public $sex; publi…
1.Model中Code.php <?php /** * Created by PhpStorm. * User: moka同学 * Date: 2016/07/25 * Time: 10:48 */ namespace app\models; use yii\base\Model; class Code extends Model{ public $verifyCode; public function rules() { return [ ['verifyCode','captcha','c…
public function rules(){ return [ ['title','required','message'=>'标题不能为空'], ['title','string','min'=>2,'max'=>200,'tooShort'=>'标题不能少于两位','tooLong'=>'标题不能大于200位'], ['content','required','message'=>'内容不能为空'], ['description','string','max'=…
方法一: //判断签约状态 $signed = 0; $sql="SELECT * from usho_community_sign_record WHERE com_id=$r->id AND end_date = (SELECT MAX(end_date) AS Largest_End_date from usho_community_sign_record WHERE com_id=$r->id)"; $sign_model = Yii::$app->db-&g…
表结构 现在有客户表.订单表.图书表.作者表, 客户表Customer (id customer_name) 订单表Order (id order_name customer_id book_id) 图书表 (id book_name author_id) 作者表 (id author_name) 模型定义 下面是这4个个模型的定义,只写出其中的关联 Custom…