我想在wordpress管理页面中下载csv…它在本地服务器上运行良好,但实时提供已发送的标题错误
错误是我想在wordpress管理页面中下载csv…它在本地服务器上运行良好,但实时提供已发送的标题错误,wordpress,csv,http-headers,localhost,administration,Wordpress,Csv,Http Headers,Localhost,Administration,错误是 警告:无法修改标题信息-标题已由/home/londoner/public_html/pkfones.com/pinquest/wp admin/includes/template.php:1679)中/home/londoner/public_html/pkfones.com/pinquest/wp-content/plugins/wp-gamesize/setgamesize_admin.php发送,请确保您正在调用ob start()在代码执行的开始(或非常接近)处。这将缓冲所有输
警告:无法修改标题信息-标题已由/home/londoner/public_html/pkfones.com/pinquest/wp admin/includes/template.php:1679)中/home/londoner/public_html/pkfones.com/pinquest/wp-content/plugins/wp-gamesize/setgamesize_admin.php发送,请确保您正在调用
ob start()
在代码执行的开始(或非常接近)处。这将缓冲所有输出,并允许您随时发送标题。您可以将其放在functions.php的最上面
这在本地而非live上起作用的原因可能是服务器配置的不同,默认情况下,您在本地进行缓冲,但在live上不进行缓冲。这是确保您的开发和生产环境尽可能相似的一个很好的理由。嗯,恐怕您必须告诉用户错误消息中提到的那些行实际上包含哪些内容。这就是错误消息的目的:它确切地显示了导致发送输出的行。的可能重复
The code for download that works at localhost is but live at hostgather server it throughs error
ob_get_clean();
header("Content-type: text/x-csv"); # DECLARING FILE TYPE
header("Content-Transfer-Encoding: binary");
header("Content-Disposition: attachment; filename=".$csv_file_name); # EXPORT GENERATED CSV FILE
header("Pragma: no-cache");
header("Expires: 0");
echo $fields;
exit;