您的报告有错误,无法处理!\ 尝试使用函数“output();”输出命令,并在控制台中手动 运行
Your report has an error and couldn 't be processed!\ Try to output the command using the function `output();` and run it manually in the console
我尝试从 PHPJasper 生成 pdf,但出现此错误,我找不到解决方案。请告诉我答案或任何其他生成报告的方式
"Your report has an error and couldn 't be processed!\ Try to output
the command using the function output();
and run it manually in the
console."
<?php
require __DIR__ . '/vendor/autoload.php';
use PHPJasper\PHPJasper;
try{
$input = __DIR__ . '/Report/Coffee.jasper';
$output = __DIR__ . '/Report';
$options = ['format' => ['pdf']];
$jasper = new PHPJasper;
$jasper->process($input, $output, $options)->execute();
} catch(Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
您是否尝试过消息中提到的 output() 命令?
您可以尝试像这样简单的操作并检查它的输出:
$x = $jasper->process(
$input,
$output,
$options
)->output();
print_r($x);
exit(1);//just to avoid getting error handler on your framework
有时这会告诉您更多信息。如果它显示要执行的命令行,请尝试直接在命令行上执行它,您可能会在那里获得更多信息。
需要考虑的常见事项:
- 用户(在您的情况下可能是 Web 服务器用户)没有访问或写入您正在创建文件的文件夹的权限
- 也许该行之前已经生成,错误是该文件已经存在。尝试为每个报告生成生成一个随机名称以避免这种情况;或生成文件,在应用程序中提供并删除它
我尝试从 PHPJasper 生成 pdf,但出现此错误,我找不到解决方案。请告诉我答案或任何其他生成报告的方式
"Your report has an error and couldn 't be processed!\ Try to output the command using the function
output();
and run it manually in the console."
<?php
require __DIR__ . '/vendor/autoload.php';
use PHPJasper\PHPJasper;
try{
$input = __DIR__ . '/Report/Coffee.jasper';
$output = __DIR__ . '/Report';
$options = ['format' => ['pdf']];
$jasper = new PHPJasper;
$jasper->process($input, $output, $options)->execute();
} catch(Exception $e) {
echo 'Caught exception: ', $e->getMessage(), "\n";
}
?>
您是否尝试过消息中提到的 output() 命令?
您可以尝试像这样简单的操作并检查它的输出:
$x = $jasper->process(
$input,
$output,
$options
)->output();
print_r($x);
exit(1);//just to avoid getting error handler on your framework
有时这会告诉您更多信息。如果它显示要执行的命令行,请尝试直接在命令行上执行它,您可能会在那里获得更多信息。
需要考虑的常见事项: - 用户(在您的情况下可能是 Web 服务器用户)没有访问或写入您正在创建文件的文件夹的权限 - 也许该行之前已经生成,错误是该文件已经存在。尝试为每个报告生成生成一个随机名称以避免这种情况;或生成文件,在应用程序中提供并删除它