gethostname

(PHP 5 >= 5.3.0, PHP 7, PHP 8)

gethostnameKonak ismini döndürür

Açıklama

gethostname(): string|false

gethostname() işlevi yerel makinenin standard konak ismini döndürür.

Değiştirgeler

Bu işlevin değiştirgesi yoktur.

Dönen Değerler

Başarısızlık durumunda false. aksi takdirde konak ismini bir dizge olarak döndürür.

Örnekler

Örnek 1 - gethostname() örneği

<?php
echo gethostname(); // çıktısı şu olabilir: posta
?>

Ayrıca Bakınız

  • gethostbyname() - Belirtilen konak adına ait IPv4 adresini döndürür
  • gethostbyaddr() - Belirtilen IP adresine çözümlenen konak ismini döndürür
  • php_uname() - PHP'nin çalıştığı işletim sistemi hakkında bilgi döndürür

add a note add a note

User Contributed Notes 2 notes

up
-10
solaris
4 years ago
To the prev. note: **NEVER USE***
#`sudo hostname servername`

Some *nix systems will then force to set the 'servername' as new hostname!
up
-16
kurdtpage at gmail dot com
5 years ago
On Linux, use the command `hostname` to view your host name, or `sudo hostname servername` to set it
To Top