限时免费试用:欢迎注册 api.bigmodel.org ,快速体验大模型 API 接入服务。
当前位置:标签 / function

标签:function

TP5错误 | A non well formed numeric value encountered

数据表字段是create_time timestamp 默认:CURRENT_TIMESTAMP 使用时间会出现以下错误: A non well formed numeric value encountered 这是因为tp5框架会自动转换时间 解决方案如下: class powerModel extends Model { protected $pk =

jq学习笔记(一)基础

$(function(){ alert($) //返回jq对象 alert($()) //返回jq对象 alert($('#box')) //返回jq对象 alert($('#box').css('color','red')) //返回jq对象 }); 加载模式 $(document).ready(function(){ }); 简写形式: $(funct

类库 | 字符串截取,支持中文和其他编码

工作中使用的,觉得挺好用的,分享给大家 /** * 字符串截取,支持中文和其他编码 * @static * @access public * @param string $str 需要转换的字符串 * @param string $start 开始位置 * @param string $length 截取长度 * @param string $charset

tp5+小程序开发笔记(九)小程序开发

mvc思想 view层 home.wxml model层 home.model.js controller层 home.js 数据的加载与绑定 home模型的model层 class Home{ //构造函数 constructor(){ } getBannerDate(id,callBack){ wx.request({ url:'http://www.c

tp5+小程序开发笔记(六)

在application/extra下的配置文件都会被tp5自动加载 新建setting.php return[ 'img_prefix'=>'http://wmc.com/images' ] 使用模型的获取器拼接图片路径 tp5中只有public是公开的 public/images/1,jpg config('配置文件.配置名称'); $a = confi

tp5+小程序开发笔记(五)数据库操作

设置带版本号的路由 Route::get('api/v1/banner/:id','api/v1.banner/getBanner'); 1.tp5原生sql use think\Db; Db::query("select * from user where id=?",[$id]); 2.查询构建器 Db::table('user')->where('id

tp5+小程序开发笔记(四)异常处理

1.捕获异常 2.处理异常(记录日志 或者 修复异常 或者 返回客户端) 3.抛出异常 try{ $banner = ..... }catch(Exception $ex) { $err = [ 'error_code=>'10001, 'msg'=>$ex->getMessage() ]; return json($err,400); } 200是正确获得

tp5+小程序开发笔记(一)tp5路由/传参/验证

AOP编程思想--面向切面编程 tp5路由: (设置了路由后pathinfo失效) Route::rule('路由表达式','路由地址','请求类型','路由参数(数组)','变量规则(数组)'); 请求类型:get post delete put any(默认所有) use think\Route; Route::rule('test','api/Test