Home >Backend Development >PHP Tutorial >PHP导出excel,t无法分割单元格,而是显示一段空格

PHP导出excel,t无法分割单元格,而是显示一段空格

WBOY
WBOYOriginal
2016-06-06 20:43:251619browse

<code>    $name='down';
    header( "Cache-Control: public" );
    header( "Pragma: public" );
    header("Content-type:application/vnd.ms-excel");
    header("Content-Disposition:attachment;filename=".$name.".xlsx");
    header('Content-Type:APPLICATION/OCTET-STREAM');

    echo “ID”.“\t”;
    echo “username”.“\t”;
</code>

这样输出后,ID跟username还是在一个单元格里,只是中间空了一段空格。
\n 可以换行

回复内容:

<code>    $name='down';
    header( "Cache-Control: public" );
    header( "Pragma: public" );
    header("Content-type:application/vnd.ms-excel");
    header("Content-Disposition:attachment;filename=".$name.".xlsx");
    header('Content-Type:APPLICATION/OCTET-STREAM');

    echo “ID”.“\t”;
    echo “username”.“\t”;
</code>

这样输出后,ID跟username还是在一个单元格里,只是中间空了一段空格。
\n 可以换行

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn