mune
V2EX  ›  PHP

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

  •  
  •   mune · Oct 27, 2017 · 3227 views
    This topic created in 3139 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   ·   4257 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 39ms · UTC 05:24 · PVG 13:24 · LAX 22:24 · JFK 01:24
    ♥ Do have faith in what you're doing.