Php 在Windows 7上使用shell_exec打印
Hi将使用shell_exec直接打印PDF文件。 我的代码是:Php 在Windows 7上使用shell_exec打印,php,windows,shell-exec,Php,Windows,Shell Exec,Hi将使用shell_exec直接打印PDF文件。 我的代码是: <?php shell_exec( 'print /d:"EPSON MFC-J265W" c:\file.txt'); ?> 我打赌你需要把它放在引号里 <?php shell_exec( 'print /d:"EPSON MFC-J265W" c:\file.txt'); ?> 我刚刚找到了一个解决办法 $updateCommand = "w32tm /config /syncfromflags:m
<?php
shell_exec( 'print /d:"EPSON MFC-J265W" c:\file.txt');
?>
我打赌你需要把它放在引号里
<?php
shell_exec( 'print /d:"EPSON MFC-J265W" c:\file.txt');
?>
我刚刚找到了一个解决办法
$updateCommand = "w32tm /config /syncfromflags:manual /manualpeerlist:\\\"".$timeServers."\\\" /update";
$updateCommandCmd = 'cmd /c " '.$updateCommand.' "';
$updateResult = shell_exec($updateCommandCmd);
使用cmd/c并转义\和“创建类似
cmd /c " w32tm /config /syncfromflags:manual /manualpeerlist:\"0.europe.pool.ntp.org 1.europe.pool.ntp.org\" /update "
仅在windows 7上使用此技巧(抱歉)不要为收到的每个错误消息创建多个问题,而是在当前问题的注释中添加错误。