You can write directly to the tty (screen) even when the shell has redirected output, with:<?php$h = fopen(posix_ctermid(), "rb+");fwrite($h, "Testing direct output\n");fclose($h);?>
(PHP 4, PHP 5, PHP 7, PHP 8)
posix_ctermid — Denetim uçbiriminin dosya yolunu döndürür
Sürecin denetim uçbiriminin dosya yolunu içeren bir dizge döner. Hata durumunda atanan hata numarasına posix_get_last_error() işlevi ile erişilebilir.
Bu işlevin bağımsız değişkeni yoktur.
İşlem sırasında bir hata oluşursa posix_get_last_error()
işlevi ile öğrenilmek üzere bir hata numarası atanır ve false
döner,
yoksa uçbirimin yolunu içeren bir dizge döner.
Örnek 1 - posix_ctermid() örneği
Bu örnekte üzerinde çalışılan uçbirimin yolu gösterilmektedir.
<?php
echo posix_ctermid() . " üzerinde çalışıyorum.";
?>
You can write directly to the tty (screen) even when the shell has redirected output, with:<?php$h = fopen(posix_ctermid(), "rb+");fwrite($h, "Testing direct output\n");fclose($h);?>