当前位置: 首页>>代码示例>>PHP>>正文


PHP Request::getContent方法代码示例

本文整理汇总了PHP中Illuminate\Support\Facades\Request::getContent方法的典型用法代码示例。如果您正苦于以下问题:PHP Request::getContent方法的具体用法?PHP Request::getContent怎么用?PHP Request::getContent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Illuminate\Support\Facades\Request的用法示例。


在下文中一共展示了Request::getContent方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: handleWebhook

 /**
  * Handle a Stripe webhook call.
  *
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function handleWebhook()
 {
     $payload = (array) json_decode(Request::getContent(), true);
     $method = 'handle' . studly_case(str_replace('.', '_', $payload['type']));
     if (method_exists($this, $method)) {
         return $this->{$method}($payload);
     } else {
         return $this->missingMethod();
     }
 }
开发者ID:autocar,项目名称:laravel-billing,代码行数:15,代码来源:WebhookController.php

示例2: login

 public function login()
 {
     $raw = json_decode(Request::getContent());
     $user = User::where('name', $raw->name)->where('password', $raw->pass)->firstOrFail();
     return Response::json(['status_code' => 200, 'data' => $user]);
     // return redirect()->intended('dashboard');
     // }
     // abort(403, "You're not authorized to access this public REST API.");
     // $auth = auth()->guard('api');
     // if ($auth->check()) {
     // return $auth->user();
     // };
     // abort(403, "You're not authorized to access this public REST API.");
 }
开发者ID:antho-firuze,项目名称:_g.ene.sys_prototype1_,代码行数:14,代码来源:SystemController.php

示例3: handle

 /**
  * Handles the request made to StyleCI by the GitHub API.
  *
  * @return \Illuminate\Http\JsonResponse
  */
 public function handle()
 {
     $class = 'StyleCI\\StyleCI\\Events\\Repo\\GitHub\\GitHub' . ucfirst(camel_case(Request::header('X-GitHub-Event'))) . 'Event';
     if (!class_exists($class)) {
         throw new BadRequestHttpException('Event not supported.');
     }
     $data = Request::input();
     $repo = Repo::find($data['repository']['id']);
     if (!$repo) {
         throw new BadRequestHttpException('Request integrity validation failed.');
     }
     list($algo, $sig) = explode('=', Request::header('X-Hub-Signature'));
     $hash = hash_hmac($algo, Request::getContent(), $repo->token);
     if (!Str::equals($hash, $sig)) {
         throw new BadRequestHttpException('Request integrity validation failed.');
     }
     event(new $class($repo, $data));
     return new JsonResponse(['message' => 'Event successfully received.']);
 }
开发者ID:mikaelmattsson,项目名称:StyleCI,代码行数:24,代码来源:GitHubController.php

示例4: getJsonPayload

 /**
  * Get the JSON payload for the request.
  *
  * @return array
  */
 protected function getJsonPayload()
 {
     return (array) json_decode(Request::getContent(), true);
 }
开发者ID:syntropysoftware,项目名称:cryptoffice-frontend,代码行数:9,代码来源:WebhookController.php

示例5: __construct

 public function __construct()
 {
     $k2Data = Request::getContent();
     $this->k2 = new K2($k2Data);
 }
开发者ID:nicolacimmino,项目名称:RIoT,代码行数:5,代码来源:StoreK2Request.php

示例6: validateMD5Data

 /**
  * Validate the request MD5 data header.
  *
  * @param  string $clientSecret
  * @return boolean
  */
 public function validateMD5Data($clientSecret = '')
 {
     $md5 = $this->header('CONTENT_MD5');
     if (parent::isJson()) {
         $content = parent::getContent();
         if (empty($md5) and empty($content)) {
             return true;
         }
         return md5($content . $clientSecret) == $md5;
     }
     $input = $this->all();
     if (!empty($input)) {
         foreach ($input as $key => $item) {
             if (str_contains($key, '/')) {
                 unset($input[$key]);
             }
         }
     }
     if (empty($md5) and empty($input)) {
         return true;
     }
     return md5(http_build_query($input) . $clientSecret) == $md5;
 }
开发者ID:andrims21,项目名称:eBri,代码行数:29,代码来源:Request.php

示例7: notify

 /**
  * 
  * 支付结果通用通知
  * @param function $callback
  * 直接回调函数使用方法: notify(you_function);
  * 回调类成员函数方法:notify(array($this, you_function));
  * $callback  原型为:function function_name($data){}
  */
 public static function notify($callback, &$msg)
 {
     //获取通知的数据
     $xml = Request::getContent();
     //$GLOBALS['HTTP_RAW_POST_DATA'];
     //如果返回成功则验证签名
     try {
         $result = PayResults::Init($xml);
     } catch (WxException $e) {
         $msg = $e->errorMessage();
         return false;
     }
     return call_user_func($callback, $result);
 }
开发者ID:sandywalker,项目名称:xiehouxing,代码行数:22,代码来源:PayApi.php


注:本文中的Illuminate\Support\Facades\Request::getContent方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。