2016-09-29 57 views

回答

-1

這是代碼是以.csv格式導出文件。

<?php 
    //Database connection starts 
    ob_start(); 
    session_start(); 
    include_once('includes/config.php'); 
    //Database connection ends 

    //export .csv file starts here 
    $filename = "testing-exports.csv"; 

    header("Content-type: text/csv"); 
    header("Content-Disposition: attachment; filename=$filename"); 
    header("Pragma: no-cache"); 
    header("Expires: 0"); 

    $insquery = "SELECT username FROM r_institution where status=1"; 
    $insresults = $conn->query($insquery); 
    foreach ($insresults as $rs) { 
     $row = array(); 
     $row[] = stripslashes($rs["username"]); 
     $content[] = $row; 
    } 
    $content = array(); 
    $title = array("Institution Emails"); 
    foreach ($insresults as $rs) { 
     $row = array(); 
     $row[] = stripslashes($rs["username"]); 
     $content[] = $row; 
    } 
    $output = fopen('php://output', 'w'); 
    fputcsv($output, $title); 
    foreach ($content as $con) { 
     fputcsv($output, $con); 
    } 
?> 
+0

感謝阿都拉,但我知道的SharePoint Online不允許寫PHP或C#代碼。只允許客戶端腳本。糾正我,如果我錯了! SharePoint Online是以每個用戶爲基礎進行授權的,您可以將SharePoint Online作爲獨立計劃購買,也可以作爲Office 365計劃的一部分進行購買,詳細信息請參閱許可詳細信息 –

+0

@amitshaligram對不起,即使我不知道分享點.. –

0

轉到您的圖書館 - >庫選項卡 - >導出到Excel

相關問題