V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
mune
V2EX  ›  PHP

请教如何使用 PHP 获取 ajax 的 delete, put 请求?

  •  
  •   mune · Oct 27, 2017 · 3159 views
    This topic created in 3109 days ago, the information mentioned may be changed or developed.
    2 replies    2017-10-27 12:02:57 +08:00
    orderc
        1
    orderc  
       Oct 27, 2017
    传个参数模拟
    dobelee
        2
    dobelee  
       Oct 27, 2017
    <?php
    $method = "PUT";
    $varName = "_{$method}";
    $_SERVER['REQUEST_METHOD'] === $method
    ? parse_str(file_get_contents('php://input', false , null, -1 , $_SERVER['CONTENT_LENGTH'] ), $$varName)
    : $$varName = [];

    var_dump($_PUT);
    var_dump($_DELETE);

    http://php.net/manual/zh/features.file-upload.put-method.php
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2343 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 04:56 · PVG 12:56 · LAX 21:56 · JFK 00:56
    ♥ Do have faith in what you're doing.