1
예를 들어 콘솔에서 PC 시간을 변경하고 싶습니다.php exec 콘솔 및 입력 작업
C:\Users\user>time
The current time is: 15:25:21,04
Enter the new time:
PHP :
exec('time', $out, $ret);
/*
$out =
The current time is: 15:25:21,04
Enter the new time:
*/
어떻게 새로운 시간을 보낼 수? 1 개 라인없이
UPD
가 time
콘솔 응용 프로그램은 표준 입력 (STDIN)에서 입력을 기대 echo <timestring> | time
#Thx to reox
#Working example:
$next_hour = date('H:i:s', strtotime('+1 hour'));
$command = 'time';
$handle = popen($command, 'r');
echo 'Command responce: <br>';
while($line = fgets($handle)) {
echo $line;
echo '<br>';
}
pclose($handle);
$handle = popen($command, 'w');
fputs($handle, $next_hour);
pclose($handle);
Windows에서 작동합니까? ("c : \ Users"부분은 OS를 제안합니다) – Nanne
@reox 업데이트보기 – cetver
@cetver mhh afaik는 php가 stdin을 지원하지 않습니까? 나는 오래 전에 SSH와 같은 문제가 있었다 ... 당신은 단지 암호를 넣을 수 없다 ... 나는 그것과 같은 문제가 여기 있다고 생각한다. – reox