摘要:
use Illuminate\Support\Facades\Input; //引入Input类 public function index(){ if($_POST){ var_dump(Input::get('title','123456')); } Input::get('参数名','如果参数 阅读全文
摘要:
获取器,在获取数据的字段值后自动进行处理: class User extends Model { public function getStatusAttr($value) { $status = [-1=>'删除',0=>'禁用',1=>'正常',2=>'待审核']; return $status 阅读全文
摘要:
一对一关联,A表中一条数据对应B表中一条数据 class User extends Model{ public function profile() { return $this->hasOne('Profile')->field('id,name,email'); }} //hasOne('关联模 阅读全文
摘要:
修改器的作用是可以在数据赋值的时候自动进行转换处理 class Product extends Model{ public function setNameAttr($value) { return strtolower($value); } } $user = new Model(); $user 阅读全文
摘要:
模型设置数据表 <?php namespace app\index\model; use think\Model; class Product extends Model{ public function getStatusAttr($value) { $status = [-1=>'删除',0=> 阅读全文