freeCodeCamp/guide/chinese/php/functions/die-and-exit/index.md

22 lines
550 B
Markdown
Raw Normal View History

---
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)