本文整理匯總了PHP中CSV::moveToDB方法的典型用法代碼示例。如果您正苦於以下問題:PHP CSV::moveToDB方法的具體用法?PHP CSV::moveToDB怎麽用?PHP CSV::moveToDB使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類CSV
的用法示例。
在下文中一共展示了CSV::moveToDB方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: array
<?php
require_once 'csv.php';
require_once 'connect.php';
session_start();
if (isset($_FILES['report'])) {
$errors = array();
$file_name = $_FILES['report']['name'];
$file_tmp = $_FILES['report']['tmp_name'];
$file_type = $_FILES['report']['type'];
$file_ext = strtolower(end(explode('.', $_FILES['report']['name'])));
$expensions = array("csv");
if (in_array($file_ext, $expensions) === false) {
$errors[] = "extension not allowed";
}
if (empty($errors) == true) {
move_uploaded_file($file_tmp, "uploads/" . $file_name);
$csv = new CSV($conn);
$reports = $csv->convertCSV();
if ($csv->moveToDB($reports[0], 'pntickets') == true && $csv->moveToDB($reports[1], 'jlptickets') == true) {
$_SESSION['success'] = "File uploaded";
header('Location: index.php');
}
} else {
$_SESSION['failure'] = "Error uploading file";
header('Location: settings.php');
}
}