本文整理汇总了PHP中toDate函数的典型用法代码示例。如果您正苦于以下问题:PHP toDate函数的具体用法?PHP toDate怎么用?PHP toDate使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了toDate函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: search
function search()
{
$widget['date'] = true;
$this->assign("widget", $widget);
$map = $this->_search();
if (method_exists($this, '_search_filter')) {
$this->_search_filter($map);
}
if (empty($_POST["be_start_date"]) && empty($_POST["en_start_date"])) {
$start_date = toDate(mktime(0, 0, 0, date("m"), 1, date("Y")), 'Y-m-d');
$end_date = toDate(mktime(0, 0, 0, date("m") + 1, 0, date("Y")), 'Y-m-d');
$map['start_date'] = array(array("egt", $start_date), array("elt", $end_date));
} else {
$start_date = $_POST["be_start_date"];
$end_date = $_POST["en_start_date"];
}
$this->assign('start_date', $start_date);
$this->assign('end_date', $end_date);
$model = D("Schedule");
if (!empty($model)) {
$this->_list($model, $map);
}
$this->assign('type_data', $this->type_data);
$this->display();
return;
}
示例2: doJoin
public function doJoin()
{
$dao = D("Members");
if ($account = $dao->create()) {
$id = $dao->add();
$this->account = $account;
$sendto = array($account['email']);
if (GetValue('is_welcome_email') == 1) {
$welcome = GetValue(is_welcome_email);
if ($welcome) {
$welcome = str_replace(array('{name}', '{email}', '{time}', '{url}', '{sitename}', '{adminemail}'), array($account['lastname'] . " " . $account['firstname'], $account['email'], toDate($list['createdate']), GetValue('siteurl'), GetValue('sitename'), GetValue('email')), $welcome);
sendmail($sendto, 'Welcome to ' . GetValue('sitename'), GetValue('welcome_email_content'));
}
}
$info = $dao->where("id='{$id}'")->find();
setloginstatus($info);
if ($this->isAjax()) {
$this->success('do join success');
} elseif (isset($_SESSION['back'])) {
redirect($_SESSION['back']);
} else {
$this->redirect('MemberIndex/index');
}
} else {
$this->error($dao->getError());
}
}
示例3: index
public function index()
{
if (IS_POST) {
if (empty($_POST['catid'])) {
$this->error("请选择数据来源");
}
$map['catid'] = array('in', $_POST['catid']);
$map['status'] = array('eq', 1);
$article = M('Article');
$articlelist = $article->where($map)->order('create_time desc')->select();
$download = M('Download');
$downloadlist = $download->where($map)->order('create_time desc')->select();
$photo = M('Photo');
$photolist = $photo->where($map)->order('create_time desc')->select();
if (isset($_POST['sitemaptype'])) {
$type = $_POST['sitemaptype'];
}
$sitemapstr = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n";
switch ($type) {
case 0:
$sitemapstr .= "<urlset>\r\n";
break;
case 1:
$sitemapstr .= "<urlset xmlns=\"http://www.sitemaps.org/schemas/sitemap/0.9\">\r\n";
break;
}
foreach ($articlelist as $value) {
$sitemapstr .= "<url>\r\n";
$sitemapstr .= "<loc>Article/show?id=" . $value['id'] . "</loc>\r\n";
$sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n";
$sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n";
$sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n";
$sitemapstr .= "</url>\r\n\r\n";
}
foreach ($downloadlist as $value) {
$sitemapstr .= "<url>\r\n";
$sitemapstr .= "<loc>Download/show?id=" . $value['id'] . "</loc>\r\n";
$sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n";
$sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n";
$sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n";
$sitemapstr .= "</url>\r\n\r\n";
}
foreach ($photolist as $value) {
$sitemapstr .= "<url>\r\n";
$sitemapstr .= "<loc>Photo/show?id=" . $value['id'] . "</loc>\r\n";
$sitemapstr .= "<lastmod>" . toDate(NOW_TIME, 'Y-m-d') . "</lastmod>\r\n";
$sitemapstr .= "<changefreq>" . $_POST['changefreq'] . "</changefreq>\r\n";
$sitemapstr .= "<priority>" . $_POST['priority'] . "</priority>\r\n";
$sitemapstr .= "</url>\r\n\r\n";
}
$sitemapstr .= "</urlset>";
file_put_contents("../sitemap.xml", $sitemapstr);
$this->success("sitemap在线生成完成");
} else {
$cate = new CategoryModel();
$this->list = $cate->getMyCategory();
//加载栏目
$this->display();
}
}
示例4: article
public function article()
{
$Blogs = D('Article');
$blog = $Blogs->where(array('status' => 1))->getField('id,title,description,create_time,uid');
$RssConf = array('channelTitle' => 'zswin社交类博客', 'channelLink' => 'http://zswin.cn', 'channelDescrīption' => 'zswin开源博客', 'copyright' => 'zswin');
$RSS = new Rss($RssConf);
foreach ($blog as $k => $v) {
$RSS->AddItem($v['title'], CSU('/artc/' . $v['id'], 'Index/artc', array('id' => $v['id'])), $v['description'], toDate($v['create_time']), $v['id'], get_username($v['uid']));
}
$RSS->SaveToFile("./rss.xml");
echo $RSS->Show();
}
示例5: addUpdateLogSubmit
public function addUpdateLogSubmit()
{
$m = M('Updatelog');
$data['content'] = $_POST['content'];
$data['copyright'] = $_POST['copyright'];
$data['createTime'] = toDate(time());
$data['uid'] = session('uid');
$result = $m->add($data);
if ($result) {
writeOperationLog(APP_NAME, MODULE_NAME, ACTION_NAME, '添加更新日志');
$this->ajaxReturn($data, '添加升级日志成功!', true);
} else {
$this->ajaxReturn($data, '添加升级日志失败!', false);
}
}
示例6: addArticleSubmit
public function addArticleSubmit()
{
$data['title'] = $_POST['title'];
$data['column'] = $_POST['cid'];
$data['source'] = $_POST['source'];
$data['content'] = $_POST['content'];
$data['createTime'] = toDate(time());
$m = M('article');
$result = $m->add($data);
if ($result) {
$this->ajaxReturn('成功', '文章发布成功!', true);
} else {
$this->ajaxReturn('失败', '文章发布失败!', false);
}
}
示例7: downloadxls
public function downloadxls()
{
$where = 1;
$name = "全部订单:" . time();
if ($_REQUEST["time1"] || $_REQUEST["time2"]) {
$time1 = get_safe_replace($_REQUEST["time1"]);
$time2 = get_safe_replace($_REQUEST["time2"]);
/*strtotime($time2)-($day*86400);*/
if ($time1 == $time2) {
$time1 = strtotime($time1) - 86400;
} else {
$time1 = strtotime($time1);
}
/*相同日期则选择一天*/
$where .= " and add_time > '" . $time1 . "' and add_time < '" . strtotime($time2) . "'";
$name = "时间段" . toDate($time1, "Y/m/d") . "-" . toDate(strtotime($time2), "Y/m/d");
}
$order = M(MODULE_NAME)->where($where)->getfield('id,sn,add_time,consignee,mobile,order_amount,province,city,area,address');
//
$data = array();
foreach ($order as $key => $vv) {
$oid .= $key == 0 ? $vv['id'] : ',' . $vv['id'];
}
if (empty($oid)) {
$this->success('数据为空!');
exit;
}
$od['order_id'] = array('in', $oid);
$order_data = M("order_data")->where($od)->select();
$area = M('area')->getfield('id,name');
foreach ($order_data as $key => $v) {
$data[$key][1] = $order[$v['order_id']]['sn'] . "号";
$data[$key][2] = toDate($order[$v['order_id']]["add_time"], "Y/m/d H:i:s");
$data[$key][3] = $v['product_name'];
$data[$key][4] = $v['type_name'];
$data[$key][5] = $order[$v['order_id']]["pay_status"] == 2 ? '已支付' : '未支付';
$data[$key][6] = $order[$v['order_id']]["order_amount"] . "元";
$data[$key][7] = $order[$v['order_id']]["consignee"];
$data[$key][8] = $order[$v['order_id']]["mobile"];
$data[$key][9] = $area[$order[$v['order_id']]["province"]];
$data[$key][10] = $area[$order[$v['order_id']]["city"]];
$data[$key][11] = $area[$order[$v['order_id']]["area"]];
$data[$key][12] = $order[$v['order_id']]["address"];
}
$title = array(1 => "订单编号", 2 => "订单时间", 3 => "订购产品", 4 => "订购类型", 5 => "支付状态", 6 => "订单价格", 7 => "姓名", 8 => "手机", 9 => "省份", 10 => "城市", 11 => "区域", 12 => "地址");
$this->exportexcel($data, $title, $name);
}
示例8: downloadxls
public function downloadxls()
{
$where = 1;
$name = "全部订单:" . time();
if ($_REQUEST["time1"] || $_REQUEST["time2"]) {
$time1 = get_safe_replace($_REQUEST["time1"]);
$time2 = get_safe_replace($_REQUEST["time2"]);
/*strtotime($time2)-($day*86400);*/
if ($time1 == $time2) {
$time1 = strtotime($time1) - 86400;
} else {
$time1 = strtotime($time1);
}
/*相同日期则选择一天*/
$where .= " and createtime > '" . $time1 . "' and createtime < '" . strtotime($time2) . "'";
$name = "预约试驾" . toDate($time1, "Y/m/d") . "-" . toDate(strtotime($time2), "Y/m/d");
}
$area = M('area')->getfield('id,name');
$bill = M(MODULE_NAME)->where($where)->select();
foreach ($bill as $key => $vo) {
$pro = M("product")->where('id=' . $vo['car_name'])->cache(true)->find();
$data[$key][1] = $vo['id'];
$data[$key][2] = $pro['title'];
$data[$key][3] = toDate($vo['datetime'], "Y/m/d");
$data[$key][4] = $vo['username'];
$data[$key][5] = $vo['sex'] == 1 ? "先生" : '女士';
if ($vo['sex'] == 0) {
$data[$key][5] = '未知';
}
$data[$key][6] = '手机' . $vo['mobile'];
$data[$key][7] = $area[$vo['province']];
$data[$key][8] = $area[$vo['city']];
$data[$key][9] = $area[$vo['area']];
$shopname = M("shop")->where('shopcode=\'' . $vo['shop_name'] . '\'')->getfield('sname');
if (!$shopname) {
$shopname = "客户未选择";
}
$data[$key][10] = $shopname;
}
$title = array(1 => "预约号", 2 => "预约车型", 3 => "预约时间", 4 => "预约人", 5 => "性别", 6 => "电话", 7 => "省份", 8 => "城市", 9 => "区域", 10 => "经销商");
$order = A('Admin/Order');
$order->exportexcel($data, $title, $name);
}
示例9: checkLogin
public function checkLogin()
{
// 用户权限检查
if (session('verify') != md5($_POST['verify'])) {
$this->ajaxReturn('验证失败', "验证码错误,请重试!", false);
}
$map['uid'] = $this->_post('uid');
$map['pwd'] = md5($this->_post('pwd'));
$map["status"] = array('eq', 1);
$db = M('user');
$authInfo = $db->where($map)->select();
if (1 < count($authInfo)) {
$this->ajaxReturn('错误', '登录信息重复', false);
} elseif (1 == count($authInfo)) {
if ($authInfo[0]['uid'] == 'admin') {
//session('USER_AUTH_KEY',true);
}
session('id', (int) $authInfo[0]['id']);
//用户id,强制转换成int,其实本来就是int,但从数据库读出来就成字符型了,权限要用int类型判断,字符型的数字则没有权限
session('name', $authInfo[0]['name']);
//别名
session('uid', $authInfo[0]['uid']);
//登录名
session('lastIp', $authInfo[0]['lastIp']);
session('lastTime', $authInfo[0]['lastTime']);
session('count', $authInfo[0]['count']);
session('tishiyu', $authInfo[0]['tishiyu']);
session('language', $authInfo[0]['tishiyu']);
// 保存登录信息
$User = M('User');
$data = array();
$data['id'] = $authInfo[0]['id'];
$data['lastTime'] = toDate(time());
$data['count'] = array('exp', 'count+1');
$data['lastIp'] = get_client_ip();
$User->save($data);
$this->ajaxReturn('成功', "登录成功!", true);
} elseif (1 > count($authInfo)) {
$this->ajaxReturn('登录失败', "登录失败,请联系管理员处理!", false);
}
}
示例10: filter
/**
* @函数 filter
* @功能 过滤订单信息
*/
private function filter($list)
{
foreach ($list as $key => $value) {
//$order_list[todate_time] = date("Y-m-d",$order_list[todate_time]);
$list[$key][order_time] = toDate($list[$key][order_time]);
//设置显示的创建时间
/*$list[$key]['createtime']=date("Y-m-d H:i:s",$value['createtime']);
//设置显示的最后修改时间
if(!$value['lastmodifytime']){
$list[$key]['lastmodifytime']="无";
}else{
$list[$key]['lastmodifytime']=date("Y-m-d H:i:s",$value['lastmodifytime']);
}
//文章标题过长时裁剪
if(strlen($list[$key]['subject'])>80){
$list[$key]['subject']=$this->cutString($list[$key]['subject'],0,20).'...';
}*/
}
}
示例11: wxpayok
public function wxpayok()
{
$paysn = $_REQUEST["out_trade_no"];
$transaction_id = $_REQUEST["transaction_id"];
if (!empty($transaction_id) && !empty($paysn)) {
$order = M("order")->field("id,userid,title,mcount,add_time,username,wxmsg")->where("paysn='" . $paysn . "'")->find();
if (empty($order)) {
$type = "piao";
$order = M("piaoorder")->where("paysn='" . $paysn . "'")->find();
} else {
$type = "";
}
if ($order["id"] > 0) {
M($type . "order")->where("paysn='" . $paysn . "'")->setfield("transaction_id", $transaction_id);
M($type . "order")->where("paysn='" . $paysn . "'")->setfield("status", 1);
}
if ($order['userid'] > 0) {
$u = M("user")->field("wxpas,id")->where("id=" . $order['userid'])->find();
}
if ($u["wxpas"] && $order['wxmsg'] < 2) {
import("@.ORG.Weixin");
$wechatObj = new Wechat();
$data = "{\r\n\t\t\t\t\t\t \"touser\":\"" . $u['wxpas'] . "\",\r\n\t\t\t\t\t\t \"template_id\":\"SCFdz1m9pGOO6U-LXp6qv8CUJakT3_Zk-74tjdnK0ok\",\r\n\t\t\t\t\t\t \"url\":\"http://www.gzsrex.com" . U('Home/Order/look', array('oid' => $order["id"])) . "\",\r\n\t\t\t\t\t\t \"topcolor\":\"#003cff\",\r\n\t\t\t\t\t\t \"data\":{\r\n\t\t\t\t\t\t\t\t \"first\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"恭喜你购买成功!\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword1\":{\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order['username'] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword2\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order["title"] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword3\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . $order['mcount'] . "人\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF0600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"keyword4\": {\r\n\t\t\t\t\t\t\t\t\t \"value\":\"" . toDate($order['add_time'], "y-m-d H:i:s") . "添加\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t },\r\n\t\t\t\t\t\t\t\t \"remark\":{\r\n\t\t\t\t\t\t\t\t\t \"value\":\"价格:" . $order['amount'] . "\",\r\n\t\t\t\t\t\t\t\t\t \"color\":\"#FF6600\"\r\n\t\t\t\t\t\t\t\t }\r\n\t\t\t\t\t\t }\r\n\t\t\t\t\t }";
/*
{first.DATA}}
客户名:{{keyword1.DATA}}
产品名称:{{keyword2.DATA}}
人数:{{keyword3.DATA}}
时间:{{keyword4.DATA}}
{{remark.DATA}}*/
M($type . "order")->where("paysn='" . $paysn . "'")->setInc("wxmsg");
//增加通知次数
echo $wechatObj->tplmsg($data);
} else {
echo "订单不存在!";
}
}
}
示例12: index
public function index()
{
$user_id = get_user_id();
$map = $this->_search();
if (method_exists($this, '_filter')) {
$this->_filter($map);
}
$model = D("PayView");
if (empty($_POST['start_date']) & empty($_POST['end_date'])) {
$start_date = toDate(mktime(0, 0, 0, date("m"), 1, date("Y")), 'Y-m-d');
$end_date = toDate(mktime(0, 0, 0, date("m") + 1, 0, date("Y")), 'Y-m-d');
$this->_set_search("start_date", $start_date);
$this->_set_search("end_date", $end_date);
$map['create_time'] = array(array('gt', date_to_int($start_date)), array('lt', date_to_int($end_date)));
}
$this->assign('start_date', $start_date);
$this->assign('end_date', $end_date);
if (!empty($model)) {
$this->_list($model, $map);
}
$this->display();
return;
}
示例13: index
public function index()
{
$map = $this->_search("PoView", true);
if (method_exists($this, '_filter')) {
$this->_filter($map);
}
if (empty($_POST['start_date']) & empty($_POST['end_date'])) {
$start_date = toDate(mktime(0, 0, 0, date("m"), 1, date("Y")), 'Y-m-d');
$end_date = toDate(mktime(0, 0, 0, date("m") + 1, 0, date("Y")), 'Y-m-d');
$map['po_date'] = array(array('egt', $start_date), array('elt', $end_date));
} else {
$start_date = $_POST['start_date'];
$end_date = $_POST['end_date'];
}
$this->assign('start_date', $start_date);
$this->assign('end_date', $end_date);
$sql = D("PoView")->buildSql();
$model = new Model();
$list = $model->table($sql . "a")->where($map)->order('supplier,po_no')->select();
$this->assign("list", $list);
$this->display();
return;
}
示例14: excel
public function excel()
{
Vendor('Excel.php-excel');
$map['id'] = array('in', $_REQUEST['id']);
$orders = $this->dao->where($map)->select();
$xls = array();
$xls[0][0] = "编号";
$xls[0][1] = "金额";
$xls[0][2] = "运输方式";
$xls[0][3] = "运费";
$xls[0][4] = "手续费";
$xls[0][5] = "保险金";
$xls[0][6] = "付款方式";
$xls[0][7] = "购买时间";
$xls[0][8] = "附加留言";
$xls[0][9] = "IP地址";
$xls[0][10] = "邮箱";
$xls[0][11] = "姓";
$xls[0][12] = "名";
$xls[0][13] = "地址";
$xls[0][14] = "电话";
$xls[0][15] = "邮编";
$xls[0][16] = "城市";
$xls[0][17] = "省份";
$xls[0][18] = "国家";
$xls[0][19] = "订单状态";
$xls[0][20] = "快递方式";
$xls[0][21] = "重量";
$i = 1;
foreach ($orders as $o) {
$xls[$i][0] = $o['sn'];
$xls[$i][1] = $o['orders_total'];
$xls[$i][2] = $o['shipping_method'];
$xls[$i][3] = $o['shippingmoney'];
$xls[$i][4] = $o['paymoney'];
$xls[$i][5] = $o['insurance'];
$xls[$i][6] = $o['payment_module_code'];
$xls[$i][7] = toDate($o['dateline']);
$xls[$i][8] = $o['BuyNote'];
$xls[$i][9] = $o['ip_address'] . "(" . get_ip_area($o['ip_address']) . ")";
$xls[$i][10] = $o['delivery_email'];
$xls[$i][11] = $o['delivery_firstname'];
$xls[$i][12] = $o['delivery_lastname'];
$xls[$i][13] = $o['delivery_address'];
$xls[$i][14] = $o['delivery_telephone'];
$xls[$i][15] = $o['delivery_zip'];
$xls[$i][16] = $o['delivery_city'];
$xls[$i][17] = $o['delivery_state'];
$xls[$i][18] = $o['delivery_country'];
$xls[$i][19] = L('orders_status_' . $o['orders_status']);
$xls[$i][20] = $o['shipping_method'];
$xls[$i][21] = $o['total_weight'];
$i++;
}
$xls_obj = new Excel_XML('UTF-8', false, 'SOP订单列表');
$xls_obj->addArray($xls);
$xls_obj->generateXML("SOP");
}
示例15: _folder_export
private function _folder_export($model, $map)
{
$list = $model->where($map)->select();
//导入thinkphp第三方类库
Vendor('Excel.PHPExcel');
//$inputFileName = "Public/templete/contact.xlsx";
//$objPHPExcel = PHPExcel_IOFactory::load($inputFileName);
$objPHPExcel = new PHPExcel();
$objPHPExcel->getProperties()->setCreator("小微OA")->setLastModifiedBy("小微OA")->setTitle("Office 2007 XLSX Test Document")->setSubject("Office 2007 XLSX Test Document")->setDescription("Test document for Office 2007 XLSX, generated using PHP classes.")->setKeywords("office 2007 openxml php")->setCategory("Test result file");
// Add some data
$i = 1;
//dump($list);
//编号,类型,标题,登录时间,部门,登录人,状态,审批,协商,抄送,审批情况,自定义字段
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", "编号")->setCellValue("B{$i}", "类型")->setCellValue("C{$i}", "标题")->setCellValue("D{$i}", "登录时间")->setCellValue("E{$i}", "部门")->setCellValue("F{$i}", "登录人")->setCellValue("G{$i}", "状态")->setCellValue("H{$i}", "审批")->setCellValue("I{$i}", "协商")->setCellValue("J{$i}", "抄送")->setCellValue("J{$i}", "审批情况");
foreach ($list as $val) {
$i++;
//dump($val);
$id = $val['id'];
$doc_no = $val["doc_no"];
//编号
$name = $val["name"];
//标题
$confirm_name = strip_tags($val["confirm_name"]);
//审批
$consult_name = strip_tags($val["consult_name"]);
//协商
$refer_name = strip_tags($val["refer_name"]);
//协商
$type_name = $val["type_name"];
//流程类型
$user_name = $val["user_name"];
//登记人
$dept_name = $val["dept_name"];
//不美分
$create_time = $val["create_time"];
$create_time = toDate($val["create_time"], 'Y-m-d H:i:s');
//创建时间
$step = show_step_type($val["step"]);
//
//编号,类型,标题,登录时间,部门,登录人,状态,审批,协商,抄送,审批情况,自定义字段
$objPHPExcel->setActiveSheetIndex(0)->setCellValue("A{$i}", $doc_no)->setCellValue("B{$i}", $type_name)->setCellValue("C{$i}", $name)->setCellValue("D{$i}", $create_time)->setCellValue("E{$i}", $dept_name)->setCellValue("F{$i}", $user_name)->setCellValue("G{$i}", $step)->setCellValue("H{$i}", $confirm_name)->setCellValue("I{$i}", $consult_name);
$model_flow_field = D("FlowField");
$field_list = $model_flow_field->get_data_list($id);
// dump($field_list);
$k = 0;
if (!empty($field_list)) {
foreach ($field_list as $field) {
$k++;
$field_data = $field['name'] . ":" . $field['val'];
$location = get_cell_location("J", $i, $k);
$objPHPExcel->setActiveSheetIndex(0)->setCellValue($location, $field_data);
}
}
}
// Rename worksheet
$objPHPExcel->getActiveSheet()->setTitle('流程统计');
// Set active sheet index to the first sheet, so Excel opens this as the first sheet
$objPHPExcel->setActiveSheetIndex(0);
$file_name = "流程统计.xlsx";
// Redirect output to a client’s web browser (Excel2007)
header("Content-Type: application/force-download");
header('Content-Type: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
header("Content-Disposition:attachment;filename =" . str_ireplace('+', '%20', URLEncode($file_name)));
header('Cache-Control: max-age=0');
$objWriter = PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
//readfile($filename);
$objWriter->save('php://output');
exit;
}