Home > Backend Development > PHP Tutorial > PHP die(message) 函数

PHP die(message) 函数

WBOY
Release: 2016-06-23 14:33:11
Original
1001 people have browsed it

die(message)

输出信息并中断 PHP 程序。

语法: void die(string message);

返回值: 无

函数种类: PHP 系统功能

内容说明

本函数将送出字符串到浏览器并中断 PHP 程序 (Script)。参数 message 为欲送出的字符串。

使用范例

下例中,若无法打开 /etc/shadow 时,传给浏览器抱歉,无法打开: /etc/shadow。


$filename = "/etc/shadow";
$file = @fopen($filename, 'r') or die("抱歉,无法打开: ".$filename);
echo "本行不会执行";
?>

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