當前位置: 首頁>>代碼示例>>PHP>>正文


PHP toDate函數代碼示例

本文整理匯總了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;
 }
開發者ID:2ger,項目名稱:trunk,代碼行數:26,代碼來源:ScheduleAction.class.php

示例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());
     }
 }
開發者ID:anshidai,項目名稱:bagsloves,代碼行數:27,代碼來源:MemberPublicAction.class.php

示例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();
     }
 }
開發者ID:echenxin-company,項目名稱:YTBT,代碼行數:60,代碼來源:SitemapAction.class.php

示例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();
 }
開發者ID:Willshon,項目名稱:OLCS,代碼行數:12,代碼來源:RssController.class.php

示例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);
     }
 }
開發者ID:ahmatjan,項目名稱:yaojike,代碼行數:15,代碼來源:SysinfoAction.class.php

示例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);
     }
 }
開發者ID:ahmatjan,項目名稱:yaojike,代碼行數:15,代碼來源:ArticleAction.class.php

示例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);
 }
開發者ID:anywn3773,項目名稱:bydproject,代碼行數:47,代碼來源:OrderAction.class.php

示例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);
 }
開發者ID:anywn3773,項目名稱:bydproject,代碼行數:43,代碼來源:BillAction.class.php

示例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);
     }
 }
開發者ID:ahmatjan,項目名稱:yaojike,代碼行數:41,代碼來源:LoginAction.class.php

示例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).'...';
                     }*/
     }
 }
開發者ID:qzyunwei,項目名稱:order,代碼行數:25,代碼來源:ChangeAdminController.class.php

示例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 "訂單不存在!";
         }
     }
 }
開發者ID:anywn3773,項目名稱:gzsrex,代碼行數:38,代碼來源:PayAction.class.php

示例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;
 }
開發者ID:uwitec,項目名稱:semoa,代碼行數:23,代碼來源:PayAction.class.php

示例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;
 }
開發者ID:uwitec,項目名稱:semoa,代碼行數:23,代碼來源:PoAction.class.php

示例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");
 }
開發者ID:anshidai,項目名稱:bagsloves,代碼行數:58,代碼來源:OrdersAction.class.php

示例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;
 }
開發者ID:zqstudio2015,項目名稱:smeoa,代碼行數:69,代碼來源:FlowAction.class.php


注:本文中的toDate函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。