本文整理汇总了PHP中Excel::createExcel方法的典型用法代码示例。如果您正苦于以下问题:PHP Excel::createExcel方法的具体用法?PHP Excel::createExcel怎么用?PHP Excel::createExcel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Excel
的用法示例。
在下文中一共展示了Excel::createExcel方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: export_subscriber
public function export_subscriber()
{
$subscribers = D("Subscribers")->select();
$rows = array();
foreach ($subscribers as $index => $subscriber) {
$row = array();
$row[] = $subscriber['name'];
$row[] = $subscriber['company'];
$row[] = $subscriber['contact'];
$row[] = $subscriber['business'];
$row[] = $subscriber['message'];
$row[] = date('m/d/Y', $subscriber['create_time']);
$rows[] = $row;
}
$titles = array("姓名", "公司", "联系方式", "业务方向", "留言", '时间');
foreach ($intrests_title as $key => $display) {
$titles[] = $display;
}
Excel::createExcel($rows, "Export", "SubscribersExport", $titles);
}
示例2: export_projects
public function export_projects()
{
$ids = strval($this->_param('ids'));
$status = intval($this->_param('status'));
if ($ids) {
$filter['id'] = array('in', explode(',', $ids));
}
if ($status) {
$filter['status'] = $status;
}
$projects = D("Projects")->getProjects($filter);
$columns = D("CustomColumns")->getProjectModuleColumns();
$no_needs = array('status', 'manager_id');
foreach ($columns as $k => $v) {
if (in_array($k, $no_needs)) {
continue;
}
$keynames[$k] = $v['display_name'];
}
$column_data = array();
foreach ($projects as $one) {
$single_data = array();
foreach ($keynames as $key => $name) {
if (!$one[$key]) {
$one[$key] = '';
}
$single_data[] = str_replace(' ', '', $one[$key]);
}
$column_data[] = $single_data;
}
D('AdminLogs')->saveLog('project', Utility::GetColumn($projects, 'title'), 'project_export');
Excel::createExcel($column_data, "项目", "项目导出-" . date('Y-m-d'), array_values($keynames));
}