ThinkPHP转载 | ThinkPHP5自动生成缩略图函数function thumb($src = '', $width = 500, $height = 500, $type = 1, $replace = false) { $src = './'.$src; if(is_file($src) && file_exists($src)) { $ext = pathinfo($src, PATHINFO_EXTE作者王明昌发布时间2018-07-04文章目录ThinkPHP5自动生成缩略图函数复制function thumb($src = '', $width = 500, $height = 500, $type = 1, $replace = false) { $src = './'.$src; if(is_file($src) && file_exists($src)) { $ext = pathinfo($src, PATHINFO_EXTENSION); $name = basename($src, '.'.$ext); $dir = dirname($src); if(in_array($ext, array('gif','jpg','jpeg','bmp','png'))) { $name = $name.'_thumb_'.$width.'_'.$height.'.'.$ext; $file = $dir.'/'.$name; if(!file_exists($file) || $replace == TRUE) { $image = \think\Image::open($src); $image->thumb($width, $height, $type); $image->save($file); } $file=str_replace("\\","/",$file); $file = '/'.trim($file,'./'); return $file; } } $src=str_replace("\\","/",$src); $src = '/'.trim($src,'./'); return $src; }ThinkPHP5自动生成缩略图函数
2018-02-27tp5controller与model使用数据库控制器里使用数据库 use think\Db; $info = Db::table('fly_user')->select();//用些前缀,全部查询 $info = Db::table('fly_u
2018-04-30TP5错误 | A non well formed numeric value encountered数据表字段是create_time timestamp 默认:CURRENT_TIMESTAMP 使用时间会出现以下错误: A non well formed numeric value encoun
2018-02-02tp3.2-if三层嵌套问题if标签 value1 value2 value3 if标签不支持三层嵌套,所以第三层不要用if标签,用eq标签;就能解决三层嵌套。 相等不相等 还有更多比较标签可以使用 http://documen
2018-07-04转载 | ThinkPHP5+Layui实现图片上传加预览 图片 上传图片 layui.use('upload',function(){ var upload = layui.upload, jq = layui.jquery; upload.render