//分页配置
'paginate' => [
'type' => 'amazeui',
'namespace'=>'\\thinkextend\\',
'var_page' => 'page',
],-----------------------------------------------------------------composer require shenfakuan/thinkextend安装之后,会在你的vendor目录下生成对应的文件夹,看下你的 autoload_psr4.php 文件,你会看到有这么一行'thinkextend\\' => array($vendorDir . '/shenfakuan/thinkextend/src/thinkextend')说明你已安装成功了! $count = Db::name('user')->count();// 查询满足要求的总记录数
// var_dump($count);die;
$Page = new Page($count, 10);// 实例化分页类 传入总记录数和每页显示的记录数(25)
$Page->setConfig('prev', '上一页');
$Page->setConfig('next', '下一页');
$show = $Page->show();// 分页显示输出
// 进行分页数据查询 注意limit方法的参数要使用Page类的属性
$list = Db::name('user')->limit($Page->firstRow . ',' . $Page->listRows)->select();
$this->assign('list', $list);//
$this->assign('page', $show);// 赋值分页输出
return $this->fetch();效果查看:$verify = new Verify();
$verify->entry();同样附上效果图:/**
* 生成缩略图函数
* @param $img_url 图片路径
* @param int $width 缩略图宽度
* @param int $height 缩略图高度
* @param int $thumb_type 缩微图截取类型
* @param null $small_pic 无图片是默认图片路径
* @return null|string
*/
function thumb($img_url = '', $width = 100, $height = 100, $thumb_type = 0, $default_pic = null)
{
$default_pic = empty ($default_pic) ? '/static/images/no_picture.png' : $default_pic; // 默认图
$img_path = '.' . $img_url;
if (empty ($img_url)) return $default_pic;
if (!file_exists($img_path)) return $default_pic;
list ($width_t, $height_t, $type, $attr) = getimagesize($img_path);
if ($width >= $width_t || $height >= $height_t) return $img_url;
$img_name = basename($img_url);
$img_path = str_replace($img_name, '', $img_path);
//echo $img_path;die;
$new_img_path = $img_path . 'thumb_' . $width . '_' . $height . '_' . $thumb_type . '_' . $img_name;
$thumb_url = ltrim($new_img_path, '.');
if (file_exists($new_img_path)) return $thumb_url;
switch ($thumb_type) {
case 1 : // 标识缩略图等比例缩放类型
$Image = new Image();
$Image::open($img_path . $img_name);
$thumb = $Image::thumb($width, $height, THINKIMAGE_THUMB_SCALING)->save($new_img_path);
break;
case 2 : // 标识缩略图缩放后填充类型
$Image = new Image ();
$Image::open($img_path . $img_name);
$thumb = $Image::thumb($width, $height, THINKIMAGE_THUMB_FILLED)->save($new_img_path);
break;
case 3 : // 标识缩略图居中裁剪类型
$Image = new Image ();
$Image::open($img_path . $img_name);
$thumb = $Image::thumb($width, $height, THINKIMAGE_THUMB_CENTER)->save($new_img_path);
break;
case 4 : // 标识缩略图左上角裁剪类型
$Image = new Image ();
$Image::open($img_path . $img_name);
$thumb = $Image::thumb($width, $height, THINKIMAGE_THUMB_NORTHWEST)->save($new_img_path);
break;
case 5 : // 标识缩略图右下角裁剪类型
$Image = new Image ();
$Image::open($img_path . $img_name);
$thumb = $Image::thumb($width, $height, THINKIMAGE_THUMB_SOUTHEAST)->save($new_img_path);
break;
case 6 : // 标识缩略图固定尺寸缩放类型
$Image = new Image ();
$Image::open($img_path . $img_name);
$thumb = $Image::thumb($width, $height, THINKIMAGE_THUMB_FIXED)->save($new_img_path);
break;
default :
$Image = new Image ();
$Image::open($img_path . $img_name);
$thumb = $Image::thumb($width, $height, THINKIMAGE_THUMB_SCALING)->save($new_img_path);
break;
}
return is_object($thumb) ? $thumb_url : $img_url;
}效果也有的:ThinkPHP 是一个免费开源的,快速、简单的面向对象的 轻量级PHP开发框架 ,创立于2006年初,遵循Apache2开源协议发布,是为了敏捷WEB应用开发和简化企业应用开发而诞生的。ThinkPHP从诞生以来一直秉承简洁实用的设计原则,在保持出色的性能和至简的代码的同时,也注重易用性。并且拥有众多的原创功能和特性,在社区团队的积极参与下,在易用性、扩展性和性能方面不断优化和改进,已经成长为国内最领先和最具影响力的WEB应用开发框架,众多的典型案例确保可以稳定用于商业以及门户级的开发。