2021年验证的
系统:win10
php调用命令实现文档转换:这里特别注意下 exec 涵数 是否被系统禁用了。
$retval = 1;
// exec() might be disabled
$cmd = 'start soffice --convert-to pdf D:/aaa/bbb.docx --outdir D:/aaa';
if (function_exists('exec')){
@exec($cmd, $output, $retval);
}
// Did it work?
if ($retval > 0){
exit('process_failed');
}
echo 'success';
系统:Ubuntu,
php调用命令实现文档转换:这里特别注意下 exec 涵数 是否被系统禁用了。
<?php
$retval = 1;
// exec() might be disabled
$cmd = 'export HOME=/tmp/&&/usr/bin/libreoffice --headless --convert-to pdf /www/wwwroot/test/20210327.docx --outdir ./';
if (function_exists('exec')){
@exec($cmd, $output, $retval);
echo "===";
}
// Did it work?
if ($retval > 0){
exit('process_failed');
}
本文地址:
/show-303.html
版权声明:除非特别标注原创,其它均来自互联网,转载时请以链接形式注明文章出处。