dongluojiao6322 2015-01-21 13:00
浏览 47
已采纳

json编码变量中的斜线打破了细长的api路径

i created a route in slim api like this:

$app->put('/user/:one', function ($one) {

i know i created the put wrong by using it as a get, but i can't change the app since it's live. So I have to find a way to change this so it works when the json encoded variable contains a slash. When one of the fields in the json variable contain a slash the route thinks another variable is being declared. In this url the password contains a slash and thus breaks my route:

http://someapi.nl/someappApi/api.php/user/%7B%22uuid%22:%2267b80bda2ab6f83d%22,%22username%22:%22bladude%22,%22screen_state%22:%22Aan%20het%20werk%22,%22name%22:%22bladude%22,%22last_name%22:%22asdf%22,%22email%22:%22someexample@live.nl%22,%22password%22:%22bie/rtje/%22%7D

is there a way to tell slim api it should see the entire url as one variable??? or escape the slash?

  • 写回答

2条回答 默认 最新

  • dongtuo4723 2015-01-21 13:41
    关注

    You can use a wildcard route to capture the entire query string...

    $app->put('/user/:one+', function ($one) {

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 Python中的request,如何使用ssr节点,通过代理requests网页。本人在泰国,需要用大陆ip才能玩网页游戏,合法合规。
  • ¥15 Oracle触发器记录修改前后的字段值
  • ¥100 为什么这个恒流源电路不能恒流?
  • ¥15 有偿求跨组件数据流路径图
  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 stm32开发clion时遇到的编译问题