本文整理汇总了PHP中ImportFromExcel函数的典型用法代码示例。如果您正苦于以下问题:PHP ImportFromExcel函数的具体用法?PHP ImportFromExcel怎么用?PHP ImportFromExcel使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了ImportFromExcel函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: postvalue
$error_message = "";
// if is postback (form sended) and import needed
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>";
}
示例2: strrpos
//check the file extension
$pos = strrpos($value,".");
$ext = strtoupper(substr($value,$pos));
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);
}