dongwende1984 2015-07-06 09:19
浏览 43
已采纳

抛出异常后,检测zend的module.php中的HTTP方法名称

I need to detect the HTTP method name from module.php file. For this i have tried following code which only gives me GET method,

use Zend\Http\Request;
$getRequest = new Request();
$httpMethod=$getRequest->getMethod();

But in $httpMethod variable i am only getting GET as method name. I am handling errors so in a way i need to detect the which method is being called by my REST Api. Is there any solution for this so i can detect PUT,POST and DELETE method also.

Thanks in advance.

  • 写回答

2条回答 默认 最新

  • douliaotong4944 2015-07-06 09:27
    关注

    You can use vanilla PHP;

    $httpMethod = $_SERVER['REQUEST_METHOD'];
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?