我将生成一个 csv 文件到 php 输出,因此用户可以立即下载它:
header( 'Content-Type: text/csv' );
header( 'Content-Disposition: attachment; filename=' . $filename );
$fp = fopen('php://ouput', 'w'); // Here is where error happens, line 156
if(!$fp) var_dump($fp); // output: bool(false)
但它会产生以下错误:
Warning: fopen(): Invalid php:// URL specified in /home/mustafa/xxx/includes/functions.php on line 156
Warning: fopen(php://ouput): failed to open stream: operation failed in /home/mustafa/xxx/includes/functions.php on line 156
为什么php://output
无效