array ( 0 => 'index.php', 1 => 'PHP Manual', ), 'head' => array ( 0 => 'UTF-8', 1 => 'ja', ), 'this' => array ( 0 => 'function.gethostname.php', 1 => 'gethostname', ), 'up' => array ( 0 => 'ref.network.php', 1 => 'ネットワーク 関数', ), 'prev' => array ( 0 => 'function.gethostbynamel.php', 1 => 'gethostbynamel', ), 'next' => array ( 0 => 'function.getmxrr.php', 1 => 'getmxrr', ), 'alternatives' => array ( ), 'source' => array ( 'lang' => 'ja', 'path' => 'reference/network/functions/gethostname.xml', ), ); $setup["toc"] = $TOC; $setup["toc_deprecated"] = $TOC_DEPRECATED; $setup["parents"] = $PARENTS; manual_setup($setup); ?>
(PHP 5 >= 5.3.0, PHP 7, PHP 8)
gethostname — ホスト名を取得する
この関数にはパラメータはありません。
成功時にはホスト名を示す文字列。失敗時には false
を返します
例1 簡単な gethostname() 関数の使用例
<?php
echo gethostname(); // 出力の例: sandie
?>