Jump to content

[SOLVED] Use variable in exec command


cleary1981

Recommended Posts

Hi,

 

I use the below code with apache fop to generate a pdf document. What I want to do however is name the pdf a different name on each execution using a variable for the pdf name.

 

file_put_contents('example3.xml', $xml_output);
//echo $xml_output; 
exec('fop -xml example3.xml -xsl pdffo.xsl -pdf A4drawing.pdf'); 
header('Location: A4drawing.pdf');  

Link to comment
https://forums.phpfreaks.com/topic/136658-solved-use-variable-in-exec-command/
Share on other sites

file_put_contents('example3.xml', $xml_output);
$sampleValue = 1;
//echo $xml_output; 
exec('fop -xml example3.xml -xsl pdffo.xsl -pdf A4drawing'.$sampleValue.'.pdf'); 
header('Location: A4drawing'.$sampleValue.'.pdf');  

 

And do whatever you need with $sampleValue to increment it

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.