【Stimulsoft Reports PHP教程】将导出的报表发送到服务器

发布时间 : 2018-11-29 11:49:01.000|阅读 211 次

概述:此示例显示如何使用HTML查看器在PHP服务器端发送和保存导出的报表。

相关链接:

下载Stimulsoft Reports PHP最新版本

此示例显示如何使用HTML查看器在PHP服务器端发送和保存导出的报表。为此,您需要添加onEndExportReport事件处理程序。此外,如果要仅在服务器端保存导出的报表,则需要阻止内置文件处理。为此,只需将event.preventDefault属性设置为true即可。

viewer.onEndExportReport = function (event) {
    event.preventDefault = true;
}

在PHP服务器端,您可以获取导出报表的Base64数据流。这可以在完成$ handler-> onEndExportReport事件handler.php文件。此外,例如,您可以将其保存到“reports”文件夹中的文件中。

$handler->onEndExportReport = function ($event) {
    $format = $event->format; // Export format
    $data = $event->data; // Base64 export data
    $fileName = $event->fileName; // Report file name
 
    file_put_contents('reports/'.$fileName.'.'.strtolower($format), base64_decode($data));
 
    //return StiResult::success();
    return StiResult::success("Export OK. Message from server side.");
    //return StiResult::error("Export ERROR. Message from server side.");
};

下载示例

购买Stimulsoft正版授权,请点击“咨询在线客服”哟!


扫码咨询


添加微信 立即咨询

电话咨询

客服热线
023-68661681

TOP