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


PHP ImportFromCSV函數代碼示例

本文整理匯總了PHP中ImportFromCSV函數的典型用法代碼示例。如果您正苦於以下問題:PHP ImportFromCSV函數的具體用法?PHP ImportFromCSV怎麽用?PHP ImportFromCSV使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了ImportFromCSV函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: postvalue

if (@$_POST["a"] == "added") {
    $value = postvalue("value_ImportFileName" . $id);
    $type = postvalue("type_ImportFileName" . $id);
    $importfile = getImportTableName("file_ImportFileName" . $id);
    //check the file extension
    $pos = strrpos($value, ".");
    $ext = strtoupper(substr($value, $pos));
    if ($eventObj->exists('BeforeImport')) {
        if ($eventObj->BeforeImport() === false) {
            exit(0);
        }
    }
    if ($ext == ".XLS" || $ext == ".XLSX") {
        ImportFromExcel($importfile);
    } else {
        ImportFromCSV($importfile);
    }
    if ($eventObj->exists('AfterImport')) {
        $eventObj->AfterImport($goodlines, $total_records - $goodlines);
    }
    if ($goodlines == $total_records) {
        $error_message = "<font size=2>" . $goodlines . " records were imported</font><br>";
        $error_message .= "<font size=2>To back to your list click on the <b>Back to list</b> button.</font>";
    } else {
        $error_message .= "Number of records: " . $total_records . "<br>";
        $error_message .= "Imported: " . $goodlines . "<br>";
        $error_message .= "Not imported: ";
        $error_message .= $total_records - $goodlines . "<br>";
    }
}
include 'include/xtempl.php';
開發者ID:samsulpendis,項目名稱:Instant_Appointment,代碼行數:31,代碼來源:Readings_import.php

示例2: if

	
	
	if ($eventObj->exists('BeforeImport'))
	{
		if ($eventObj->BeforeImport($pageObject) === false)
		{
			exit(0);
		}
	}
	if($ext==".XLS" || $ext==".XLSX")
	{
		ImportFromExcel($importfile, $strOriginalTableName, $ext, $keys, $keys_present, $total_records, $error_message, $goodlines, $pageObject, $cipherer);
	}	
	else 
	{
		ImportFromCSV($importfile, $strOriginalTableName, $ext, $keys, $keys_present, $total_records, $error_message, $goodlines, $pageObject, $cipherer);
	}	
	
	if($message != "")  // if error happened in ImportFromExcel or ImportFromCSV
	{
		$error_message .= "<br>".$message."<br><br>";
	}
	else if ($eventObj->exists('AfterImport'))
	{
		$eventObj->AfterImport($goodlines, $total_records-$goodlines, $pageObject);
	}
	
	if ($goodlines==$total_records)
	{
		$error_message .= "<font size=2>" . $goodlines . " records were imported</font><br>";
		$error_message .= "<font size=2>To back to your list click on the <b>Back to list</b> button.</font>";
開發者ID:helbertfurbino,項目名稱:sgmofinanceiro,代碼行數:29,代碼來源:webreport_users_import.php


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