Home  >  Article  >  Backend Development  >  Detailed explanation of php die usage

Detailed explanation of php die usage

PHPz
PHPzOriginal
2020-09-25 16:00:494144browse

php die is a function used to output a message and exit the current script. Its syntax is "die(message)". The parameter "message" specifies the message or status number written before exiting the script, and Status numbers are not written to the output.

Detailed explanation of php die usage

Definition and usage

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

This function is an alias of the exit() function.

Syntax

die(message)

Parameters

message Required. Specifies the message or status number to be written before exiting the script. Status numbers are not written to the output.

Technical details

Return value: No return value.

PHP Version: 4

Example

Output a message and exit the current script:

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

The above is the detailed content of Detailed explanation of php die usage. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn