php中的pdftk无法正常工作

时间:2011-07-06 07:38:55

标签: php codeigniter pdftk

这里是代码....它无法合并两个pdf文件...任何人都可以在代码中找到问题所在...感谢您的时间....

1 个答案:

答案 0 :(得分:1)

你使用了错误的syntax

正确的代码应如下所示:

// prepare command escaping paths of your files
$parts = '';
foreach( array( 'file1.pdf', 'file2.pdf' ) as $part )
    $parts .= escapeshellarg( $part ) . ' ';

// build command
$command = sprintf( 'pdftk %s cat output %s', $parts, escapeshellarg($output) );

// launch it
system( $command, $returnvalue );
if( $returnvalue )  printf 'There was an error.';

下次留言:请选择更具体的标题并删除不必要的代码。