Coder Social home page Coder Social logo

Comments (9)

lordGuan avatar lordGuan commented on May 1, 2024 1

果了个然,restful client我没加content-type,参数得用text才能传的了。postman的Content-Type倒是没问题,但是body默认的form-data。原来如此,学到了学到了

from biny.

billge1205 avatar billge1205 commented on May 1, 2024

GET的请求 可以直接在function的参数中传递 其他参数会在file_get_contents('php://input')里
不知道你的是什么方式的请求

from biny.

billge1205 avatar billge1205 commented on May 1, 2024

做了兼容 GET参数也可在 $this->getParam中获取 优先级GET > data数据

from biny.

lordGuan avatar lordGuan commented on May 1, 2024

我查了很多文章,也没有搞清楚为什么file_get_contents('php://input')获取不到数据

from biny.

billge1205 avatar billge1205 commented on May 1, 2024

POST的情况下能正常获取吗 还是只有 PUT DELETE 这种会获取失败
感觉是不是跟php配置或者php临时缓存的读写权限有关

from biny.

lordGuan avatar lordGuan commented on May 1, 2024

刚才我又确认了一下,从页面用ajax进行PUT是OK的,用phpstorm的工具和postman就不行。POST请求时没有问题的。

from biny.

billge1205 avatar billge1205 commented on May 1, 2024

是不是被csrf拦截了?页面ajax里有注册csrf验证信息的
在action里添加 protected $csrfValidate = false; 绕过csrf 验证看看

from biny.

lordGuan avatar lordGuan commented on May 1, 2024

并不好使(捂脸
刚才我抓了一下postman和phpstorm的请求,发现content-length都是0,会是这个的影响么

from biny.

billge1205 avatar billge1205 commented on May 1, 2024

Content-Type 设置成 application/x-www-form-urlencoded ? 数据传 abc=123&cba=321这种
如果是application/json 的话 数据应该传json {“abc”:123} 类似这种

from biny.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.