即使使用带有ajax的error_reporting(0),仍会出现php错误

时间:2014-08-29 18:20:01

标签: php jquery ajax

我正在使用一个名为mpdf的pdf生成库。

它有一些已知的错误问题,建议是抑制错误,但我仍然看到错误,尽管它告诉它不要显示错误......

我的阿贾克斯......

$('#generate-preview').on('click', function() {

  var childs_image = $('#child-image').attr('src');
  var childs_name = $('#childs-name').val();    
  $.ajax({
    url: 'index.php?route=pdfengine/pdfengine/get_html',
    type: 'post',
    dataType: 'json',
    data: {
        childs_name : childs_name,
        childs_image : childs_image         

    },
    beforeSend: function() {

    },
    complete: function() {

    },
    success: function(json) {
        alert(json['childs_name']);
        alert(json['childs_image']);            

        }
    });
});

我的PHP

 public function get_html() {

    $childs_name = $this->request->post['childs_name'];      
    $childs_image = $this->request->post['childs_image'];    

    include('convert-to-pdf/mpdf.php');

    $mpdf=new mPDF();

    $mpdf->WriteHTML('Hello '.$childs_name.'<br /><img src="'.$childs_image.'" />');


    $mpdf->Output(DIR_TEMPORARY_IMAGES.'test.pdf','F');

    $json = array();    

    $json['childs_name'] = $childs_name;
    $json['childs_image'] = $childs_image;

    $this->response->setOutput(json_encode($json));


 }

在我的php中包含的文件中,我设置了error_reporting(0);,但是当我运行ajax时,我仍然看到此文件中的错误。

1 个答案:

答案 0 :(得分:0)

尝试添加:

php_flag display_errors off

到你的.htaccess如果你有权访问你可以关闭php.ini中的display_errors