通知设置 新通知
添加提示文字
cc110110 发表了文章 • 0 个评论 • 1960 次浏览 • 2018-08-23 14:35
需要修改的代码文件
common->builder->table->Builder.php 第1885行后添加case 'tiptext':
$row[$column['name'].'__'.$column['type']] = '<div class="el-tooltip" aria-describedby="el-tooltip-127" tabindex="0" style="color: rgb(64, 158, 255); text-overflow: ellipsis; overflow: hidden; white-space: nowrap;" title="'.$row[$column['name']].'" data-toggle="tooltip" >'.$row[$column['name']].'</div>';
break; 查看全部
需要修改的代码文件
common->builder->table->Builder.php 第1885行后添加
case 'tiptext':
$row[$column['name'].'__'.$column['type']] = '<div class="el-tooltip" aria-describedby="el-tooltip-127" tabindex="0" style="color: rgb(64, 158, 255); text-overflow: ellipsis; overflow: hidden; white-space: nowrap;" title="'.$row[$column['name']].'" data-toggle="tooltip" >'.$row[$column['name']].'</div>';
break;
阿里云oss对象存储插件
wangchunfu 发表了文章 • 4 个评论 • 5661 次浏览 • 2018-08-17 15:42
关于框架中模块多数据库调用的方法探讨
小兔言言 发表了文章 • 1 个评论 • 2191 次浏览 • 2018-03-05 16:11
首先我复制了application目录中的database.php,然后命名为database2.php,我的数据库是pgsql的
<?php
return [
// 数据库类型
'type' => 'pgsql',
// 服务器地址
'hostname' => '172.2.2.254',
// 数据库名
'database' => 'cmsdb',
// 用户名
'username' => 'postgres',
// 密码
'password' => 'postgres',
// 端口
'hostport' => '5432',
// 连接dsn
'dsn' => '',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => 'dp_',
// 数据库调试模式
'debug' => true,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => false,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => false,
// 时间字段取出后的默认时间格式
'datetime_format' => false,
// 是否需要进行SQL性能分析
'sql_explain' => false,
];
然后修改application/config.php
增加以下代码:
$db_hikvision = require_once('database2.php');
//海康数据库配置
'db_hikvision' => $db_hikvision,这样配置部分就配置好了。
项目里面调用的时候就直接使用以下命令
$data_list = Db::connect('db_hikvision')
->table('oc_person')
->where($map)
->order($order)
->paginate();如果不加connect('db_hikvision')那么仍旧连接的是默认的数据库配置,希望能对大家有帮助!
当然在用thinkphp连接pgsql的时候,请在pgsql里面执行下:thinkphp\library\think\db\connector\pgsql.slq 这个文件 查看全部
首先我复制了application目录中的database.php,然后命名为database2.php,我的数据库是pgsql的
<?php然后修改application/config.php
return [
// 数据库类型
'type' => 'pgsql',
// 服务器地址
'hostname' => '172.2.2.254',
// 数据库名
'database' => 'cmsdb',
// 用户名
'username' => 'postgres',
// 密码
'password' => 'postgres',
// 端口
'hostport' => '5432',
// 连接dsn
'dsn' => '',
// 数据库连接参数
'params' => [],
// 数据库编码默认采用utf8
'charset' => 'utf8',
// 数据库表前缀
'prefix' => 'dp_',
// 数据库调试模式
'debug' => true,
// 数据库部署方式:0 集中式(单一服务器),1 分布式(主从服务器)
'deploy' => 0,
// 数据库读写是否分离 主从式有效
'rw_separate' => false,
// 读写分离后 主服务器数量
'master_num' => 1,
// 指定从服务器序号
'slave_no' => '',
// 是否严格检查字段是否存在
'fields_strict' => false,
// 数据集返回类型
'resultset_type' => 'array',
// 自动写入时间戳字段
'auto_timestamp' => false,
// 时间字段取出后的默认时间格式
'datetime_format' => false,
// 是否需要进行SQL性能分析
'sql_explain' => false,
];
增加以下代码:
$db_hikvision = require_once('database2.php');
//海康数据库配置这样配置部分就配置好了。
'db_hikvision' => $db_hikvision,
项目里面调用的时候就直接使用以下命令
$data_list = Db::connect('db_hikvision')如果不加connect('db_hikvision')那么仍旧连接的是默认的数据库配置,希望能对大家有帮助!
->table('oc_person')
->where($map)
->order($order)
->paginate();
当然在用thinkphp连接pgsql的时候,请在pgsql里面执行下:thinkphp\library\think\db\connector\pgsql.slq 这个文件
Tp5中api开发中异常输出为html的问题
dragonlhp 发表了文章 • 0 个评论 • 1983 次浏览 • 2018-02-05 20:06
1:按照TP扩展异常的方式引用这个文件
看云 /manual/thinkphp5_1/354092
2:判断一下配置文件的默认输出类型
配置文件:
// 判断默认输出类型
if ($app['default_return_type'] == 'json') {
// 异常处理handle类 留空使用 \think\exception\Handle
$app['exception_handle'] = '\\app\\common\\exception\\JsonException';
}
return $app;
查看全部
1:按照TP扩展异常的方式引用这个文件
看云 /manual/thinkphp5_1/354092
2:判断一下配置文件的默认输出类型
配置文件:
// 判断默认输出类型
if ($app['default_return_type'] == 'json') {
// 异常处理handle类 留空使用 \think\exception\Handle
$app['exception_handle'] = '\\app\\common\\exception\\JsonException';
}
return $app;
多表查询怎么写
dolphinphp 回复了问题 • 2 人关注 • 1 个回复 • 2471 次浏览 • 2018-01-09 17:55
关于linkages标签 三个选项框不能对应三层结构数据的问题
chhnang 发表了文章 • 0 个评论 • 1796 次浏览 • 2017-10-23 16:13
1.06升级1.07 快捷编辑都不能用【已解决】
hefeng 回复了问题 • 1 人关注 • 1 个回复 • 2075 次浏览 • 2017-10-01 11:12
text 文本框 的 input-group 类型
清风笑对人生 发表了文章 • 0 个评论 • 1773 次浏览 • 2017-09-23 17:08
关于升级到DolphinPHP1.0.7后,报错的解决办法
dolphinphp 发表了文章 • 2 个评论 • 2365 次浏览 • 2017-09-20 11:20
解决办法:
手动删除runtime目录下的所有缓存文件
2.自建模块报错
解决办法:
打开 \application\common\builder\table\Builder.php
将is_object($row_list[0]) 改为 is_object(current($row_list))
3.创建自定义表单项报错
解决办法:
打开 \application\common.php
将
if (!empty($_layout && isset($_layout[$form['name']]))) {
改为
if (!empty($_layout) && isset($_layout[$form['name']])) {
4.节点无法禁用和启用
下载“Menu.zip”附件,将Menu.php覆盖到 application\admin\controller
5.无法使用水印
下载“修复水印问题.zip”附件,覆盖到框架内
6.编辑模块顶级节点后,模块节点不显示的问题
下载“修复节点问题.zip”覆盖
7.表格顶部下拉菜单筛选超过2个时,样式错误的问题
下载“修正顶部下拉筛选样式问题.zip”覆盖
查看全部
解决办法:
手动删除runtime目录下的所有缓存文件
2.自建模块报错
解决办法:
打开 \application\common\builder\table\Builder.php
将is_object($row_list[0]) 改为 is_object(current($row_list))
3.创建自定义表单项报错
解决办法:
打开 \application\common.php
将
if (!empty($_layout && isset($_layout[$form['name']]))) {
改为
if (!empty($_layout) && isset($_layout[$form['name']])) {
4.节点无法禁用和启用
下载“Menu.zip”附件,将Menu.php覆盖到 application\admin\controller
5.无法使用水印
下载“修复水印问题.zip”附件,覆盖到框架内
6.编辑模块顶级节点后,模块节点不显示的问题
下载“修复节点问题.zip”覆盖
7.表格顶部下拉菜单筛选超过2个时,样式错误的问题
下载“修正顶部下拉筛选样式问题.zip”覆盖
扩展表格按树状显示
freebirdy 发表了文章 • 2 个评论 • 5227 次浏览 • 2017-08-24 21:05
具体修改方法:
第一步:在table的Builder.php里面增加一个方法 setTreeMode/**
* 设置树状表格,此模式建议设置为无分页模式
* @param string $key 唯一标识字段
* @param string $pkey 父结点字段
* @param int $pos 可控制列位置,默认为0,即第一列
* @param int $expand 默认展开层级,默认为1
*/
public function setTreeMode($key = "id", $pkey = "pid", $pos = 0, $expand = 1)
{
if (!empty($key) && !empty($pkey)) {
$this->_vars['tree_mode'] = [
'key' => $key,
'pkey' => $pkey,
'pos' => $pos,
'expand' => $expand,
];
}
return $this;
}第二步:修改table的layout.html
找到 tbody元素,加入属性<tbody{present name='tree_mode'} id="tree_table" expand="{$tree_mode.expand|default=1}" pos="{$tree_mode.pos|default=0}"{/present}</tbody>在tbody的循环体的tr里面,加入属性<tr class="{$row['_tr_class']|default=''}"{present name='tree_mode'} id="{$row[$tree_mode['key']]}" pid="{$row[$tree_mode['pkey']]}"{/present}></tr>
第三步:下载附件 treeTable.zip,解压后放至 __LIBS__ 目录,并利用dolphinPHP引入css和js的方法,将相应的JS和CSS文件引入,即可
第四步:加入树特效的执行代码,可以放到layout.html,也可以引入自定义的js文件$('#tree_table').treeTable({
expandLevel:$('#tree_table').attr("expand"),
column:$('#tree_table').attr("pos")
});
第五步:在控制器输出表格之前调用 setTreeMode 方法return ZBuilder::make('table')
....
->setTreeMode("id", "pid", 1, 99)
->noPages() //建议使用无分页模式,取数据的时候,一次性将数据取出来
->fetch();
记↓得↓不↓要↓忘↓了↓下↓载↓附↓件!
查看全部
具体修改方法:
第一步:在table的Builder.php里面增加一个方法 setTreeMode
/**第二步:修改table的layout.html
* 设置树状表格,此模式建议设置为无分页模式
* @param string $key 唯一标识字段
* @param string $pkey 父结点字段
* @param int $pos 可控制列位置,默认为0,即第一列
* @param int $expand 默认展开层级,默认为1
*/
public function setTreeMode($key = "id", $pkey = "pid", $pos = 0, $expand = 1)
{
if (!empty($key) && !empty($pkey)) {
$this->_vars['tree_mode'] = [
'key' => $key,
'pkey' => $pkey,
'pos' => $pos,
'expand' => $expand,
];
}
return $this;
}
找到 tbody元素,加入属性
<tbody{present name='tree_mode'} id="tree_table" expand="{$tree_mode.expand|default=1}" pos="{$tree_mode.pos|default=0}"{/present}</tbody>在tbody的循环体的tr里面,加入属性
<tr class="{$row['_tr_class']|default=''}"{present name='tree_mode'} id="{$row[$tree_mode['key']]}" pid="{$row[$tree_mode['pkey']]}"{/present}></tr>
第三步:下载附件 treeTable.zip,解压后放至 __LIBS__ 目录,并利用dolphinPHP引入css和js的方法,将相应的JS和CSS文件引入,即可
第四步:加入树特效的执行代码,可以放到layout.html,也可以引入自定义的js文件
$('#tree_table').treeTable({
expandLevel:$('#tree_table').attr("expand"),
column:$('#tree_table').attr("pos")
});
第五步:在控制器输出表格之前调用 setTreeMode 方法
return ZBuilder::make('table')
....
->setTreeMode("id", "pid", 1, 99)
->noPages() //建议使用无分页模式,取数据的时候,一次性将数据取出来
->fetch();
记↓得↓不↓要↓忘↓了↓下↓载↓附↓件!
关于出现“服务器发送错误~”提示信息时如何排错的方法
dolphinphp 发表了文章 • 3 个评论 • 2293 次浏览 • 2017-07-26 16:58
然后切换到“preview”标签即可查看服务器返回的错误信息,根据信息排查即可。
查看全部
关于1.0.5版本,文件或图片上传出错的解决办法
dolphinphp 发表了文章 • 4 个评论 • 2780 次浏览 • 2017-07-13 15:16
此问题由于误删除代码造成的,给大家带来不便了,抱歉。
也可以重新在官网下载完整补丁,或者下载完整版。
此问题由于误删除代码造成的,给大家带来不便了,抱歉。
也可以重新在官网下载完整补丁,或者下载完整版。
IIS 7.下面URL Rewrite的路由配置
小兔言言 发表了文章 • 0 个评论 • 3259 次浏览 • 2017-06-28 22:17
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="thinkPhp" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration> 查看全部
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<system.webServer>
<rewrite>
<rules>
<rule name="thinkPhp" enabled="true" stopProcessing="true">
<match url=".*" />
<conditions logicalGrouping="MatchAll">
<add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
<add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
</conditions>
<action type="Rewrite" url="index.php/{R:0}" />
</rule>
</rules>
</rewrite>
</system.webServer>
</configuration>
表格页面的时间快捷编辑无法使用的解决方法
dolphinphp 发表了文章 • 0 个评论 • 1875 次浏览 • 2017-06-09 16:51
application\admin\view\layout.html
大概439行左右,添加
<script src="__LIBS__/bootstrap-datetimepicker/moment.min.js"></script>
查看全部
thinkphp+TCPDF生成PDF文件,最新版TCPDF6.2.13,熟肉!即拿即用
xin5288 发表了文章 • 1 个评论 • 4397 次浏览 • 2017-06-07 17:33
新建文件夹 / extend / Tcpdf
将附件压缩包内的东西解压到/ extend / Tcpdf
使用方法
use tcpdf\Tcpdf;
class PDF extends Common
{
public function index()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 001');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setFooterData(array(0,64,0), array(0,64,128));
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// set text shadow effect
$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
// Set some content to print
$html = <<<EOD
<h1>Welcome to <a href="h提提p://www点tcpdf点org" style="text-decoration:none;background-color:#CC0000;color:black;"> <span style="color:black;">TC</span><span style="color:white;">PDF</span> </a>!</h1>
<i>This is the first example of TCPDF library.</i>
<p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
<p>Please check the source code documentation and other examples for further information.</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="h提提p://sourceforge点net/donate/index
点
php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('example_001.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
}
} 查看全部
新建文件夹 / extend / Tcpdf
将附件压缩包内的东西解压到/ extend / Tcpdf
使用方法
use tcpdf\Tcpdf;
class PDF extends Common
{
public function index()
{
// create new PDF document
$pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
// set document information
$pdf->SetCreator(PDF_CREATOR);
$pdf->SetAuthor('Nicola Asuni');
$pdf->SetTitle('TCPDF Example 001');
$pdf->SetSubject('TCPDF Tutorial');
$pdf->SetKeywords('TCPDF, PDF, example, test, guide');
// set default header data
$pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE.' 001', PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
$pdf->setFooterData(array(0,64,0), array(0,64,128));
// set header and footer fonts
$pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
$pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
// set default monospaced font
$pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
// set margins
$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
$pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
$pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
// set auto page breaks
$pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
// set image scale factor
$pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
// set some language-dependent strings (optional)
if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
require_once(dirname(__FILE__).'/lang/eng.php');
$pdf->setLanguageArray($l);
}
// ---------------------------------------------------------
// set default font subsetting mode
$pdf->setFontSubsetting(true);
// Set font
// dejavusans is a UTF-8 Unicode font, if you only need to
// print standard ASCII chars, you can use core fonts like
// helvetica or times to reduce file size.
$pdf->SetFont('dejavusans', '', 14, '', true);
// Add a page
// This method has several options, check the source code documentation for more information.
$pdf->AddPage();
// set text shadow effect
$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
// Set some content to print
$html = <<<EOD
<h1>Welcome to <a href="h提提p://www点tcpdf点org" style="text-decoration:none;background-color:#CC0000;color:black;"> <span style="color:black;">TC</span><span style="color:white;">PDF</span> </a>!</h1>
<i>This is the first example of TCPDF library.</i>
<p>This text is printed using the <i>writeHTMLCell()</i> method but you can also use: <i>Multicell(), writeHTML(), Write(), Cell() and Text()</i>.</p>
<p>Please check the source code documentation and other examples for further information.</p>
<p style="color:#CC0000;">TO IMPROVE AND EXPAND TCPDF I NEED YOUR SUPPORT, PLEASE <a href="h提提p://sourceforge点net/donate/index
点
php?group_id=128076">MAKE A DONATION!</a></p>
EOD;
// Print text using writeHTMLCell()
$pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
// ---------------------------------------------------------
// Close and output PDF document
// This method has several options, check the source code documentation for more information.
$pdf->Output('example_001.pdf', 'I');
//============================================================+
// END OF FILE
//============================================================+
}
}
关于升级到1.0.3版本后,验证码不显示的解决办法
dolphinphp 发表了文章 • 0 个评论 • 2303 次浏览 • 2017-05-10 17:50
临时解决办法:
打开admin.php,将一下代码注释掉
// 关闭路由
\think\App::route(false);
临时解决办法:
打开admin.php,将一下代码注释掉
// 关闭路由
\think\App::route(false);
get_thumb 函数增加 返回完整域名 参数
momo 发表了文章 • 0 个评论 • 2001 次浏览 • 2017-04-17 10:25
自己加了一个$domain参数,给需要的人
application\common.php
if (!function_exists('get_thumb')) {
/**
* 获取图片缩略图路径
* @param int $id 附件id
* @author 蔡伟明 <314013107@qq.com>
* @return string
*/
function get_thumb($id = 0,$domain=true)
{
$path = model('admin/attachment')->getThumbPath($id);
if (!$path) {
return config('public_static_path').'admin/img/none.png';
}
if($domain){
if(empty($_SERVER['HTTPS']))
$pre="http://";
else
$pre="https://";
return $pre.$_SERVER['HTTP_HOST'].PUBLIC_PATH. $path;
}
else {
return PUBLIC_PATH. $path;
}
}
} 查看全部
有的时候我们希望获取图片路径的时候带上完整的域名,官方的get_thumb函数没有提供,
自己加了一个$domain参数,给需要的人
application\common.php
if (!function_exists('get_thumb')) {
/**
* 获取图片缩略图路径
* @param int $id 附件id
* @author 蔡伟明 <314013107@qq.com>
* @return string
*/
function get_thumb($id = 0,$domain=true)
{
$path = model('admin/attachment')->getThumbPath($id);
if (!$path) {
return config('public_static_path').'admin/img/none.png';
}
if($domain){
if(empty($_SERVER['HTTPS']))
$pre="http://";
else
$pre="https://";
return $pre.$_SERVER['HTTP_HOST'].PUBLIC_PATH. $path;
}
else {
return PUBLIC_PATH. $path;
}
}
}
DolphinPHP 框架 Excel 插件 《导出 Excel 教程》
tlerbao 发表了文章 • 7 个评论 • 10016 次浏览 • 2017-03-16 21:56
下载插件:
请自行到群文件下载 Excel 导入导出插件。
安装插件:
将插件目录移动到 /plugins 目录下,并访问后台 系统 > 扩展中心 > 插件管理 > 安装 Excel 插件。
导出 Excel 代码示例
public function export()
{
// 查询数据
$data = LevelModel::all();
// 设置表头信息(对应字段名,宽度,显示表头名称)
$cellName = [
['id', 'auto', 'ID'],
['name', 'auto', '级别名称'],
['score', 'auto', '积分要求'],
['discount', 'auto', '享受折扣'],
['create_time', 'auto', '创建时间'],
['update_time', 'auto', '更新时间']
];
// 调用插件(传入插件名,[导出文件名、表头信息、具体数据])
plugin_action('Excel/Excel/export', ['test', $cellName, $data]);
}
PS:so easy,下篇是 《导入 Excel 教程》,坑什么时候填不知道。 查看全部
下载插件:
请自行到群文件下载 Excel 导入导出插件。
安装插件:
将插件目录移动到 /plugins 目录下,并访问后台 系统 > 扩展中心 > 插件管理 > 安装 Excel 插件。
导出 Excel 代码示例
public function export()
{
// 查询数据
$data = LevelModel::all();
// 设置表头信息(对应字段名,宽度,显示表头名称)
$cellName = [
['id', 'auto', 'ID'],
['name', 'auto', '级别名称'],
['score', 'auto', '积分要求'],
['discount', 'auto', '享受折扣'],
['create_time', 'auto', '创建时间'],
['update_time', 'auto', '更新时间']
];
// 调用插件(传入插件名,[导出文件名、表头信息、具体数据])
plugin_action('Excel/Excel/export', ['test', $cellName, $data]);
}
PS:so easy,下篇是 《导入 Excel 教程》,坑什么时候填不知道。