Latest web development tutorials

PHP die () 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 die("Unable to connect to $site");
?>


Definition and Usage

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

This function is exit () alias function.


grammar

die( message )

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

technical details

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


PHP Misc Reference Manual PHP Misc Reference Manual