我在我的插件页面中使用了一个简单的数组到CSV导出功能来生成报告.
当我运行此代码时,我收到一个错误,它将导出整个html内容以及我期望的数组.
这是我的代码:
function convert_to_csv($input_array, $output_file_name, $delimiter)
{
clearstatcache();
/** open raw memory as file, no need for temp files */
$temp_memory = fopen('php://memory', 'w');
/** loop through array */
foreach ($input_array as $line) {
/** default php csv handler **/
fputcsv($temp_memory, $line, $delimiter);
}
//echo '<pre>';
//print_r($temp_memory); exit;
/** rewrind the "file" with the csv lines **/
fseek($temp_memory, 0);
/** modify header to be downloadable csv file **/
header('Content-Type: application/csv');
header('Content-Disposition: attachement; filename="' . $output_file_name . '";');
/** Send …Run Code Online (Sandbox Code Playgroud) 我在我的项目中安装fos消息包时收到错误.我会得到这个错误
"Installation request for symfony/icu == 1.2.2.0 -> satisfiable by symfony/icu[v1.2.2].
- symfony/icu v1.2.2 requires lib-icu >=4.4 -> the requested linked library
icu has the wrong version installed or is missing from your system, make sure to
have the extension providing it."
我的composer.json代码:
{
"name": "symfony/framework-standard-edition",
"license": "MIT",
"type": "project",
"description": "The \"Symfony Standard Edition\" distribution",
"autoload": {
"psr-0": { "": "src/", "SymfonyStandard": "app/" }
},
"require": {
"php": ">=5.3.3",
"symfony/symfony": "2.5.*",
"doctrine/orm": "~2.2,>=2.2.3",
"doctrine/doctrine-bundle": "~1.2",
"twig/extensions": "~1.0", …Run Code Online (Sandbox Code Playgroud)