本文整理匯總了PHP中XString::string2TwoDimArray方法的典型用法代碼示例。如果您正苦於以下問題:PHP XString::string2TwoDimArray方法的具體用法?PHP XString::string2TwoDimArray怎麽用?PHP XString::string2TwoDimArray使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類XString
的用法示例。
在下文中一共展示了XString::string2TwoDimArray方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: downloadCsvFile
public function downloadCsvFile($request, $response)
{/*{{{*/
$dir = "/tmp/financialfiles";
if(is_dir($dir)==false)
{
mkdir($dir, 0777);
}
$fileName = $dir."/".$request->filename;
if(true || false == file_exists($fileName))
{
$firstLine = $request->firstline;
$firstLine = XString::string2TwoDimArray($firstLine);
$firstLine = array_shift($firstLine);
$fileGenerator = new CsvFileGenerator($fileName, count($firstLine));
$fileGenerator->writeLine($firstLine);
$allLines = $request->content;
foreach($allLines as $lines)
{
$lines = XString::string2TwoDimArray($lines);
foreach($lines as $l)
{
$fileGenerator->writeLine($l);
}
}
$fileGenerator->closeFp();
}
$file = fopen($fileName,"r");
Header("Content-type: application/octet-stream");
Header("Accept-Ranges: bytes");
Header("Accept-Length: ".filesize($fileName));
Header("Content-Disposition: attachment; filename=".$request->filename);
echo fread($file, filesize($fileName));
fclose($file);
exit;
}/*}}}*/