:::

6-5 /csv.php

<?php
/**
 * Phone Book module
 *
 * You may not change or alter any portion of this comment or credits
 * of supporting developers from this source code or any supporting source code
 * which is considered copyrighted (c) material of the original comment or credit authors.
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 *
 * @copyright  The XOOPS Project http://sourceforge.net/projects/xoops/
 * @license    http://www.fsf.org/copyleft/gpl.html GNU public license
 * @package    Phone Book
 * @since      2.5
 * @author     tad
 * @version    $Id $
 **/

/*-----------引入檔案區--------------*/
include "header.php";

/*-----------功能函數區--------------*/

$sql = "select * from `" . $xoopsDB->prefix("phone_book") . "`";
$result = $xoopsDB->query($sql) or web_error($sql);

while ($all = $xoopsDB->fetchArray($result)) {
  $content.=implode(',',$all)."\n";
  //$content.=iconv('UTF-8', 'Big5', implode(',',$all))."\n";
}

$date=date("YmdHis");
//匯出
file_put_contents(XOOPS_ROOT_PATH . "/uploads/{$date}_phone_book.csv", $content);

//下載
header("Content-type: text/csv");
header("Content-Disposition: attachment; filename={$date}_phone_book.csv");
echo $content;

exit;

 


:::

搜尋

QR Code 區塊

https%3A%2F%2Fwww.tad0616.net%2Fmodules%2Ftad_book3%2Fpage.php%3Ftbsn%3D39%26tbdsn%3D1252

書籍目錄

展開 | 闔起

線上使用者

59人線上 (16人在瀏覽線上書籍)

會員: 0

訪客: 59

更多…