Hàm exit () trong PHP
Thí dụ
In tin nhắn và thoát khỏi tập lệnh hiện tại:
<?php
$site = "https://www.w3schools.com/";
fopen($site,"r")
or exit("Unable to connect to $site");
?>
Định nghĩa và Cách sử dụng
Hàm exit () in một thông báo và kết thúc tập lệnh hiện tại.
Cú pháp
exit(message)
Giá trị tham số
Parameter | Description |
---|---|
message | Required. A message or status number to print before terminating the script. A status number will not be written to the output, just used as the exit status. |
Chi tiết kỹ thuật
Giá trị trả lại: | Không |
---|---|
Phiên bản PHP: | 4+ |
❮ Tham chiếu khác PHP