Latest web development tutorials

PHP exit () function

PHP Misc Reference Manual PHP Misc Reference Manual

Examples

It prints a message and exits the current script:

<?php
$site = "http://www.w3cschool.cc/";
fopen($site,"r")
or exit("Unable to connect to $site");
?>


Definition and Usage

exit () function prints a message and exits the current script.

This function is die () alias function.


grammar

exit( message )

参数 描述
message 必需。规定在退出脚本之前写入的消息或状态号。状态号不会被写入输出。

technical details

return value: No return value.
PHP version: 4+


PHP Misc Reference Manual PHP Misc Reference Manual