22 lines
550 B
Markdown
22 lines
550 B
Markdown
|
---
|
|||
|
title: Die and Exit
|
|||
|
localeTitle: 死亡和退出
|
|||
|
---
|
|||
|
## 死亡和退出
|
|||
|
|
|||
|
`die()`和`exit()`函数是相同的。它们每个都带有一个包含错误消息的参数(一个字符串)。在运行时,它们输出消息并立即停止执行脚本。
|
|||
|
|
|||
|
```PHP
|
|||
|
<?php
|
|||
|
die('Die() function was run');
|
|||
|
```
|
|||
|
|
|||
|
```PHP
|
|||
|
<?php
|
|||
|
exit('Exit() function was run');
|
|||
|
```
|
|||
|
|
|||
|
#### 更多信息:
|
|||
|
|
|||
|
* [php.net die()手册](https://secure.php.net/manual/en/function.die.php)
|
|||
|
* [php.net exit()手册](https://secure.php.net/manual/en/function.exit.php)
|