PHP exit()関数
例
メッセージを出力して、現在のスクリプトを終了します。
<?php
$site = "https://www.w3schools.com/";
fopen($site,"r")
or exit("Unable to connect to $site");
?>
定義と使用法
exit()関数はメッセージを出力し、現在のスクリプトを終了します。
構文
exit(message)
パラメータ値
Parameter | Description |
---|---|
message | Required. A message or status number to print before terminating the script. A status number will not be written to the output, just used as the exit status. |
技術的な詳細
戻り値: | 何もない |
---|---|
PHPバージョン: | 4歳以上 |
❮PHPその他のリファレンス