public function testSfUpDirName__1階層上のディレクトリ名が取得できる() { $_SERVER['SCRIPT_NAME'] = 'dir1/dir2/updir/current'; $this->expected = 'updir'; $this->actual = SC_Utils::sfUpDirName(); $this->verify('ディレクトリ名'); }
function sfCSVDownload($data, $prefix = "") { if ($prefix == "") { $dir_name = SC_Utils::sfUpDirName(); $file_name = $dir_name . date("ymdHis") . ".csv"; } else { $file_name = $prefix . date("ymdHis") . ".csv"; } /* HTTPヘッダの出力 */ Header("Content-disposition: attachment; filename={$file_name}"); Header("Content-type: application/octet-stream; name={$file_name}"); Header("Cache-Control: "); Header("Pragma: "); if (mb_internal_encoding() == CHAR_CODE) { $data = mb_convert_encoding($data, 'SJIS-Win', CHAR_CODE); } /* データを出力 */ echo $data; }