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:
*/
新しい時間を送信するためにどのように?
UPD
1本のラインが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);
これはウィンドウで機能しますか? ( "c:\ Users"の部分はOSを示唆しています) – Nanne
@reox更新を参照してください – cetver
@cetver mhh afaikはphpがstdinをサポートしていませんか?私はSSHで長年前と同じ問題を抱えていました...パスワードを入れておくことはできません...私はその同じ問題がここにあると思います – reox