我尝试在我的laravel应用程序中使用JasperPHP库生成报告并面临错误:
JasperPHP.php第178行中的异常:您的报告有错误 无法处理!尝试使用该函数输出命令
output();
并在控制台中手动运行。
我的PHP代码:
$database = array(
'driver' => 'mysql',
'database' => 'infolady_service',
'username' => 'root',
'host' => 'localhost',
'password' => '',
'charset' => 'utf8',
);
$output = public_path() . '/report/'.time().'_codelution';
$ext = "pdf";
$jasper = new JasperPHP;
// Compile a JRXML to Jasper
$jasper->compile(__DIR__ . '/../../vendor/cossou/jasperphp/examples/hello_world.jrxml')->execute();
// Process a Jasper file to PDF and RTF (you can use directly the .jrxml)
$jasper->process(
__DIR__ . '/../../vendor/cossou/jasperphp/examples/hello_world.jasper', //.jasper file link
$output, //Output location
array($ext), //Extension name
array(), //Any parameter as variable
$database, //DB informations
false,
false
)->execute();