Home  >  Article  >  Backend Development  >  How to distinguish between batch deletion and individual deletion in PHP

How to distinguish between batch deletion and individual deletion in PHP

Guanhui
GuanhuiOriginal
2020-05-08 16:51:092208browse

How to distinguish between batch deletion and individual deletion in PHP

How does php distinguish between batch deletion and individual deletion

1. It can be distinguished by the request method. When it is a POST request, it is batch deletion, otherwise That is to delete individually;

if ($_SERVER['REQUEST_METHOD'] == 'POST') {
    //批量删除操作
} else {
    //单独删除操作
}

2. Judge according to the is_batch parameter passed in. If it is 1, it is deleted in batches, otherwise it is deleted individually.

if (isset($_GET['is_batch']) && $_GET['is_batch'] == 1) {
    //批量删除操作
} else {
    //单独删除操作
}

Recommended tutorial: "PHP Tutorial"

The above is the detailed content of How to distinguish between batch deletion and individual deletion in PHP. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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