上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 58 下一页
摘要: ThinkPHP6 请求要使用请求对象必须使用门面方式( think\facade\Request类负责 )调用 可以通过Request对象完成全局输入变量的检测、获取和安全过滤 支持$_GET、$_POST、$_REQUEST、$_SERVER、$_SESSION、$_COOKIE、$_ENV等系 阅读全文
posted @ 2021-06-25 09:25 学无边涯 阅读(5061) 评论(0) 推荐(0) 编辑
摘要: 1、删除数据 delete delete 方法返回影响数据的条数,没有删除返回 0 public function index(){ # 根据条件删除数据 $delete = Db::table('shop_goods')->where('id',1)->delete(); print_r($del 阅读全文
posted @ 2021-06-25 09:21 学无边涯 阅读(1875) 评论(0) 推荐(0) 编辑
摘要: 1、修改数据 update update 方法返回影响数据的条数,没修改任何数据返回 0 public function index(){ $data = ['price'=>'68']; $update = Db::table('shop_goods')->where('id',8)->updat 阅读全文
posted @ 2021-06-25 09:19 学无边涯 阅读(1075) 评论(0) 推荐(0) 编辑
摘要: 1、单条数据查询 find find 方法查询结果不存在,返回 null,否则返回结果数组 public function index(){ $find = Db::table('shop_goods')->find(5); print_r($find); } 2、多条数据查询 select sel 阅读全文
posted @ 2021-06-24 10:42 学无边涯 阅读(1266) 评论(0) 推荐(0) 编辑
摘要: 1、添加一条数据 insert insert 方法添加数据成功返回添加成功的条数,通常情况返回 1 public function index(){ $data = ['cat'=>'1','title'=>'日系小浪漫与温暖羊毛针织拼接网纱百褶中长收腰连衣裙','price'=>'1598.35' 阅读全文
posted @ 2021-06-24 10:14 学无边涯 阅读(654) 评论(0) 推荐(0) 编辑
摘要: 模型事件是指在进行模型的查询和写入操作的时候触发的操作行为 模型事件只在调用模型的方法生效,使用查询构造器操作是无效的 编号 事件 描述 事件方法名1 after_read 查询后 onAfterRead2 before_insert 新增前 onBeforeInsert3 after_insert 阅读全文
posted @ 2021-06-24 10:07 学无边涯 阅读(1444) 评论(0) 推荐(0) 编辑
摘要: 1、调试模式 和 Trace调试 根目录里 .env 文件 // 开启调试模式 和 Trace调试 APP_DEBUG = true 备:正式部署后关闭调试模式 2、变量调试 ThinPHP内置了 dump 调试方法 $shop = Db::table('shop_goods')->select() 阅读全文
posted @ 2021-06-24 09:48 学无边涯 阅读(620) 评论(0) 推荐(0) 编辑
摘要: 要使用Session类必须使用门面方式( think\facade\Session )调用 新版本不支持操作原生$_SESSION数组和所有session_开头的函数,只能通过Session类(或者助手函数)来操作 1、配置文件 session.php return [ // session nam 阅读全文
posted @ 2021-06-24 09:28 学无边涯 阅读(963) 评论(0) 推荐(0) 编辑
摘要: 要使用Cookie类必须使用门面方式( think\facade\Cookie )调用 配置文件位于配置目录下的cookie.php文件,无需手动初始化,系统会在调用之前自动进行Cookie初始化工作 1、使用 Cookie // 设置Cookie 有效期为 3600秒Cookie::set('na 阅读全文
posted @ 2021-06-24 09:24 学无边涯 阅读(588) 评论(0) 推荐(0) 编辑
摘要: 1、使用缓存 // 缓存在3600秒之后过期Cache::set('number', 10, 3600);// number自增(步进值为3)Cache::inc('number',3);// number自减(步进值为1)Cache::dec('number');// 获取缓存Cache::get 阅读全文
posted @ 2021-06-24 09:18 学无边涯 阅读(581) 评论(0) 推荐(0) 编辑
上一页 1 ··· 14 15 16 17 18 19 20 21 22 ··· 58 下一页