对image/jpeg内容类型php文件进行错误检查


Error check on image/jpeg content type php file

我有一个php文件,内容类型为:

header('Content-Type: image/jpeg');

这个文件在我的本地主机上运行得很好,但当我将它上传到服务器时,它拒绝工作,所以我试图对它启用错误检查,但没有显示任何错误。我想这是内容类型的原因,有解决办法吗:s?

谢谢。。

而不是像这样的脚本

<?php
header('Content-Type: image/jpeg');
func1();
func2();
func3();
imagejpeg(....)

像一样编写脚本

<?php   
func1();
func2();
func3();
if ( noErrorCondition ) {
  header('Content-Type: image/jpeg');
  imagejpeg(....)
}

然后根据需要添加调试输出-甚至可能添加ini_set('display_errors', true); error_reporting(E_ALL);(或关注php的error.log)