本文整理汇总了PHP中city::export_to_csv方法的典型用法代码示例。如果您正苦于以下问题:PHP city::export_to_csv方法的具体用法?PHP city::export_to_csv怎么用?PHP city::export_to_csv使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类city
的用法示例。
在下文中一共展示了city::export_to_csv方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: redirect
init_var($_POST['btn_submit']);
if ($_POST['btn_cancel']) {
log_action('Pressed cancel button');
redirect("listview_city.php");
}
if ($_POST['btn_submit']) {
log_action('Pressed submit button');
require 'subclasses/city.php';
$dbh_city = new city();
if ($message == "") {
log_action('Exported table data to CSV');
$timestamp = date('Y-m-d');
$token = generate_token(0, 'fs');
$csv_name = $token . $_SESSION['user'] . '_city_' . $timestamp . '.csv';
$filename = TMP_DIRECTORY . '/' . $csv_name;
$csv_contents = $dbh_city->export_to_csv();
$csv_file = fopen($filename, "wb");
fwrite($csv_file, $csv_contents);
fclose($csv_file);
chmod($filename, 0755);
$csv_name = urlencode($csv_name);
$message = 'CSV file successfully generated: <a href="/' . BASE_DIRECTORY . '/download_generic.php?filename=' . $csv_name . '">Download the CSV file.</a>';
$message_type = 'system';
}
}
}
require 'subclasses/city_html.php';
$html = new city_html();
$html->draw_header('CSV Exporter: City', $message, $message_type);
echo '<div class="container">';
echo '<fieldset class="container_invisible">';