Home > Backend Development > PHP Problem > How to use php die function

How to use php die function

藏色散人
Release: 2023-02-22 20:08:02
Original
5105 people have browsed it

php The die function is used to output a message and exit the current script. This function is an alias of the exit() function. Its syntax is die(message). The parameter message is required and specifies the message or status written before exiting the script. No., status number will not be written to the output.

How to use php die function

#How to use the die function in php?

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)
Copy after login

Parameters

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

Return value: No return value.

PHP Version: 4

Instance

Output a message and exit the current script:

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

The above is the detailed content of How to use php die function. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template