doumaqing6652 2016-08-26 03:18
浏览 72
已采纳

Laravel在不使用表单的情况下将数据从视图POST到ROUTE

I'm not sure what's the best way to implement this but here is what I have going

On my register.blade.php view I have a button that links to an external api link,once clicked the api will redirect the response back to register.blade.php or [localhost:8000/register] as a GET request (I have no control over that matter, only the redirect link)

how would I pass the GET data to my custom authentication controller.

Or is there a better way to implement this?

The API returns the following data and will be used to store the data in a db and authenticate the user

  • Account ID
  • Nickname
  • Access_Token (will be used to make more api calls)
  • 写回答

1条回答 默认 最新

  • doupang4126 2016-08-26 03:26
    关注

    IF the API is redirecting back as get, but has post data for example: http://localhost:8000/register?someval=something -- you'd simply use request('someval') to get that data, or you could in your control add Request $request in the attribute of the function i.e.

        public function myfunc(Request $request){
          dd($request->somevar) // will die and dump: showing "something" as a string.    
        }
    

    Whether you're sending data via get, post, patch, and use normal static post, or ajax -it'll still work. You can even pass ajax to the call. I recommend using Postman to test out get/posts it's a Chrome plugin.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统
  • ¥15 真我手机蓝牙传输进度消息被关闭了,怎么打开?(关键词-消息通知)
  • ¥15 装 pytorch 的时候出了好多问题,遇到这种情况怎么处理?
  • ¥20 IOS游览器某宝手机网页版自动立即购买JavaScript脚本
  • ¥15 手机接入宽带网线,如何释放宽带全部速度