当我在 yii2 中使用 jasperPHP 时出现此错误

This error comes when i use jasperPHP in yii2

您的报告有误,无法处理! 尝试使用函数 output(); 和 运行 在控制台中手动输出命令。

这是我的代码:

    $jasper = new JasperPHP;

    //jasper ready to call
    $jasper->compile(__DIR__ . '/../../vendor/cossou/jasperphp/examples/Simple_Blue.jrxml')->execute();

        // Process a Jasper file to PDF and RTF (you can use directly the .jrxml)
    $jasper->process(
        __DIR__ . '/../../vendor/cossou/jasperphp/examples/Simple_Blue.jasper',
        false,
        array("pdf", "rtf"),
        array("php_version" => phpversion())
    )->execute();

    // List the parameters from a Jasper file.
    $array = $jasper->list_parameters(
        __DIR__ . '/../../vendor/cossou/jasperphp/examples/Simple_Blue.jasper'
    )->execute();

    Yii::$app->response->sendFile(__DIR__ . '/../../vendor/cossou/jasperphp/examples/Simple_Blue.pdf');

万一有人遇到同样的错误首先如果你的代码有错误就会出现这个错误。 我的错误是我没有按照函数过程的正确顺序给出参数列表。 现在一切正常!!