摘要: 先在终端安装扩展包 composer require mews/captcha; 可以在config/app.php文件中修改验证码配置 'providers' => [ Mews\Captcha\CaptchaServiceProvider::class, ], 'aliases' => [ 'C 阅读全文
posted @ 2020-08-13 14:06 HighKK 阅读(147) 评论(0) 推荐(0) 编辑
摘要: use Illuminate\Support\Facades\DB; //引入数据库类 public function user(){ var_dump('aaa'); $arr = [ 'title'=>'aaaa', 'descs'=>'bbbb' ]; DB::table('new')->in 阅读全文
posted @ 2020-07-28 11:20 HighKK 阅读(115) 评论(0) 推荐(0) 编辑
摘要: use Illuminate\Support\Facades\Input; //引入Input类 public function index(){ if($_POST){ var_dump(Input::get('title','123456')); } Input::get('参数名','如果参数 阅读全文
posted @ 2020-07-28 11:18 HighKK 阅读(143) 评论(0) 推荐(0) 编辑
摘要: use Illuminate\Support\Facades\Route; Route::get('/', 'TestController@index'); //基础路由的定义,Route::请求方式('url',匿名函数);Route::请求方式('url','控制器名称@操作方法'); Rout 阅读全文
posted @ 2020-07-28 11:13 HighKK 阅读(162) 评论(0) 推荐(0) 编辑
摘要: 获取器,在获取数据的字段值后自动进行处理: class User extends Model { public function getStatusAttr($value) { $status = [-1=>'删除',0=>'禁用',1=>'正常',2=>'待审核']; return $status 阅读全文
posted @ 2020-07-24 16:58 HighKK 阅读(216) 评论(0) 推荐(0) 编辑
摘要: 一对一关联,A表中一条数据对应B表中一条数据 class User extends Model{ public function profile() { return $this->hasOne('Profile')->field('id,name,email'); }} //hasOne('关联模 阅读全文
posted @ 2020-07-24 16:45 HighKK 阅读(171) 评论(0) 推荐(0) 编辑
摘要: 修改器的作用是可以在数据赋值的时候自动进行转换处理 class Product extends Model{ public function setNameAttr($value) { return strtolower($value); } } $user = new Model(); $user 阅读全文
posted @ 2020-07-20 14:19 HighKK 阅读(157) 评论(0) 推荐(0) 编辑
摘要: 模型设置数据表 <?php namespace app\index\model; use think\Model; class Product extends Model{ public function getStatusAttr($value) { $status = [-1=>'删除',0=> 阅读全文
posted @ 2020-07-20 14:11 HighKK 阅读(150) 评论(0) 推荐(0) 编辑
摘要: 1、普通模式:关闭路由,完全使用默认的PATH_INFO方式URL; 'url_route_on' => false, 2、混合模式:开启路由,并使用路由定义+默认PATH_INFO方式的混合; 'url_route_on' => true, 'url_route_must'=> false, 3、 阅读全文
posted @ 2020-07-20 13:56 HighKK 阅读(145) 评论(0) 推荐(0) 编辑
摘要: 全局配置方式 'template' => [ 'layout_on' => true, 'layout_name' => 'layout', ] {include file="public/header" /} {__CONTENT__} {include file="public/footer"  阅读全文
posted @ 2020-07-18 14:15 HighKK 阅读(169) 评论(0) 推荐(0) 编辑