forked from science-ation/science-ation
fix filename on CSV too
This commit is contained in:
parent
795ea89ae0
commit
424274b52c
9
lcsv.php
9
lcsv.php
@ -27,6 +27,7 @@ class lcsv
|
|||||||
var $csvdata;
|
var $csvdata;
|
||||||
var $str_separator;
|
var $str_separator;
|
||||||
var $str_newline;
|
var $str_newline;
|
||||||
|
var $page_subheader;
|
||||||
|
|
||||||
function separator()
|
function separator()
|
||||||
{
|
{
|
||||||
@ -121,17 +122,19 @@ class lcsv
|
|||||||
{
|
{
|
||||||
if($this->csvdata)
|
if($this->csvdata)
|
||||||
{
|
{
|
||||||
|
$filename=strtolower($this->page_subheader);
|
||||||
|
$filename=ereg_replace("[^a-z0-9]","_",$filename);
|
||||||
//header("Content-type: application/csv");
|
//header("Content-type: application/csv");
|
||||||
header("Content-type: text/x-csv");
|
header("Content-type: text/x-csv");
|
||||||
header("Content-disposition: inline; filename=sfiab_".$this->page_subtitle.".csv");
|
header("Content-disposition: inline; filename=sfiab_".$filename.".csv");
|
||||||
header("Content-length: ".strlen($this->csvdata));
|
header("Content-length: ".strlen($this->csvdata));
|
||||||
echo $this->csvdata;
|
echo $this->csvdata;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function lcsv($subtitle,$sep=",",$nl="\r\n")
|
function lcsv($subheader,$sep=",",$nl="\r\n")
|
||||||
{
|
{
|
||||||
$this->page_subtitle=$subtitle;
|
$this->page_subheader=$subheader;
|
||||||
$this->setSeparator($sep);
|
$this->setSeparator($sep);
|
||||||
$this->setNewline($nl);
|
$this->setNewline($nl);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user