โดย tong_tong_tong » 22/06/2013 10:16 pm
ปรแกรมนี้ มันทำการ download ไฟล์ swap.txt แบบ auto
โปรแกรมนี้ชื่อ autodown.php
code ข้างใน
Code (PHP)
01.<?php
02.
03.$export_file = "swap.txt";
04.ob_end_clean();
05.ini_set('zlib.output_compression','Off');
06.
07.header('Pragma: public');
08.header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
09.header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
10.header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
11.header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
12.header ("Pragma: no-cache");
13.header("Expires: 0");
14.header('Content-Transfer-Encoding: none');
15.header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
16.header("Content-type: application/x-msexcel"); // This should work for the rest
17.header('Content-Disposition: attachment; filename="'.basename($export_file).'"');
18.
19.?>
มันทำงานได้ดีมาก แ่ต่ผมต้องการให้มันทำงานอีกครั้ง ผมก็เพิ่มตรงนี้เข้าไป แต่มันไม่ยอมทำงานที่ ทุกๆ 8 วิตามที่ตั้งไว้ ผมต้องการให้มัน download ไฟล์นี้จาก server ทุกๆ 8 วิ ปรกติถ้าเรากดปุ่ม reload ที่ browser มันจะให้ download ให้ แต่พอเขียนโปรแกรมดังนี้ มันไม่ยอม
โปรแกรมนี้ชื่อ auto.php
code ข้างใน
Code (PHP)
01.<?php echo '<html><head><title>autosave setoutput.txt</title></head>';
02.echo '<META HTTP-EQUIV="Refresh" CONTENT="8;URL=auto.php">'; //สั่งให้ reload ทุก 8 วิ
03.
04.
05.
06.
07.$export_file = "swap.txt";
08.ob_end_clean();
09.ini_set('zlib.output_compression','Off');
10.
11.header('Pragma: public');
12.header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
13.header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
14.header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
15.header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
16.header ("Pragma: no-cache");
17.header("Expires: 0");
18.header('Content-Transfer-Encoding: none');
19.header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
20.header("Content-type: application/x-msexcel"); // This should work for the rest
21.header('Content-Disposition: attachment; filename="'.basename($export_file).'"');
22.
23.
24.
25.
26.echo '</body>';
27.echo '</html>'; ?>
ปรแกรมนี้ มันทำการ download ไฟล์ swap.txt แบบ auto
โปรแกรมนี้ชื่อ autodown.php
code ข้างใน
Code (PHP)
01.<?php
02.
03.$export_file = "swap.txt";
04.ob_end_clean();
05.ini_set('zlib.output_compression','Off');
06.
07.header('Pragma: public');
08.header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
09.header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
10.header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
11.header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
12.header ("Pragma: no-cache");
13.header("Expires: 0");
14.header('Content-Transfer-Encoding: none');
15.header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
16.header("Content-type: application/x-msexcel"); // This should work for the rest
17.header('Content-Disposition: attachment; filename="'.basename($export_file).'"');
18.
19.?>
มันทำงานได้ดีมาก แ่ต่ผมต้องการให้มันทำงานอีกครั้ง ผมก็เพิ่มตรงนี้เข้าไป แต่มันไม่ยอมทำงานที่ ทุกๆ 8 วิตามที่ตั้งไว้ ผมต้องการให้มัน download ไฟล์นี้จาก server ทุกๆ 8 วิ ปรกติถ้าเรากดปุ่ม reload ที่ browser มันจะให้ download ให้ แต่พอเขียนโปรแกรมดังนี้ มันไม่ยอม
โปรแกรมนี้ชื่อ auto.php
code ข้างใน
Code (PHP)
01.<?php echo '<html><head><title>autosave setoutput.txt</title></head>';
02.echo '<META HTTP-EQUIV="Refresh" CONTENT="8;URL=auto.php">'; //สั่งให้ reload ทุก 8 วิ
03.
04.
05.
06.
07.$export_file = "swap.txt";
08.ob_end_clean();
09.ini_set('zlib.output_compression','Off');
10.
11.header('Pragma: public');
12.header("Expires: Sat, 26 Jul 1997 05:00:00 GMT"); // Date in the past
13.header('Last-Modified: '.gmdate('D, d M Y H:i:s') . ' GMT');
14.header('Cache-Control: no-store, no-cache, must-revalidate'); // HTTP/1.1
15.header('Cache-Control: pre-check=0, post-check=0, max-age=0'); // HTTP/1.1
16.header ("Pragma: no-cache");
17.header("Expires: 0");
18.header('Content-Transfer-Encoding: none');
19.header('Content-Type: application/vnd.ms-excel;'); // This should work for IE & Opera
20.header("Content-type: application/x-msexcel"); // This should work for the rest
21.header('Content-Disposition: attachment; filename="'.basename($export_file).'"');
22.
23.
24.
25.
26.echo '</body>';
27.echo '</html>'; ?>