gpt4 book ai didi

php - 检测 PHP 中的请求类型(GET、POST、PUT 或 DELETE)

转载 作者:IT老高 更新时间:2023-10-28 11:35:43 24 4
gpt4 key购买 nike

如何检测 PHP 中使用了哪种请求类型(GET、POST、PUT 或 DELETE)?

最佳答案

通过使用

$_SERVER['REQUEST_METHOD']

示例

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
// The request is using the POST method
}

更多详情请查看documentation for the $_SERVER variable .

关于php - 检测 PHP 中的请求类型(GET、POST、PUT 或 DELETE),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/359047/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com