Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/241.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/windows/16.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在Windows 7上使用shell_exec打印_Php_Windows_Shell Exec - Fatal编程技术网

Php 在Windows 7上使用shell_exec打印

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

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: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上使用此技巧(抱歉)

不要为收到的每个错误消息创建多个问题,而是在当前问题的注释中添加错误。