可以使用两个或多个参数从php调用ireport吗?
我正在用php和ireport生成一个有效的报告,但我只能发送一个参数。我想发送多个参数,以便在MySQL中创建更好的查询 以下是我用php向ireport发送一个参数的代码: 我的javascript函数可以使用两个或多个参数从php调用ireport吗?,php,jasper-reports,Php,Jasper Reports,我正在用php和ireport生成一个有效的报告,但我只能发送一个参数。我想发送多个参数,以便在MySQL中创建更好的查询 以下是我用php向ireport发送一个参数的代码: 我的javascript函数 window.open("../Report1.php?Folio=" + folio); 使用此代码,我只能提交一个参数。我不知道如何修改它以将多个参数发送到ireport 我希望这个解释足够清楚。关于您可以使用和执行类似的操作 window.open(“../Report1.php
window.open("../Report1.php?Folio=" + folio);
使用此代码,我只能提交一个参数。我不知道如何修改它以将多个参数发送到ireport
我希望这个解释足够清楚。关于您可以使用和执行类似的操作
window.open(“../Report1.php?Folio=“+Folio+”&OtherVariable=“+OtherVariable”)代码>
然后在您的PHP文件中,说一些类似于
$otherVar=$\u GET[“OtherVariable”]
此外,使用post会更安全,您可以在post调用中添加多个参数(附加变量),而不会不安全地使它们在请求URL中可见。什么可以在php报告中工作,但我使用IReportsyntarchy更正确,使用更常见的英语短语来澄清用户的意思。我需要向我的ireportFile.jasper发送两个参数。使用此代码,我只能发送一个。您可能可以从下面的答案中获得有关如何传递多个参数的帮助,尽管类似,讨论将多个参数从主报表传递到子报表。回顾这两个过程,看看你是否能让这一过程顺利进行。
<?php
$Folio=$_GET["Folio"];
function DescargarArchivo($fichero)
{
$basefichero = basename($fichero);
header( "Content-Type: application/octet-stream");
header( "Content-Length: ".filesize($fichero));
header( "Content-Disposition:attachment;filename=" .$basefichero."");
readfile($fichero);
}
$fecha = time ();
$fecha_partir1=date ( "h" , $fecha ) ;
$fecha_partir2=date ( "i" , $fecha ) ;
$fecha_partir4=date ( "s" , $fecha ) ;
$fecha_partir3=$fecha_partir1-1;
$reporte="CC_";
$filename = $reporte.''. $Folio.'.pdf';
require_once('http://localhost:9977/JavaBridge/java/Java.inc');
require('php-jru/php-jru.php');
$jru=new PJRU();
$Reporte='/var/www/html/ireportFile.jasper';
//save file
$SalidaReporte='/var/www/html/'.$filename;
//here I declare paramenres
$Parametro=new java('java.util.HashMap');
$Parametro->put("Folio", $Folio);
//mysql
$Conexion= new JdbcConnection("com.mysql.jdbc.Driver","jdbc:mysql://localhost/Ignisterra?zeroDateTimeBehavior=convertToNull","local","local");
$jru->runReportToPdfFile($Reporte,$SalidaReporte,$Parametro,$Conexion->getConnection());
if(file_exists($SalidaReporte))
{
DescargarArchivo($filename);
if(file_exists($SalidaReporte))
{
if(unlink($filename))
{
}
}
}
?>
SELECT * FROM TBL_1 WHERE ID = $P{Folio};