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


PHP Response函数代码示例

本文整理汇总了PHP中Response函数的典型用法代码示例。如果您正苦于以下问题:PHP Response函数的具体用法?PHP Response怎么用?PHP Response使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: porCategoria

 public function porCategoria($id)
 {
     $subcategorias = Subcategoria::where('categoria_id', '=', $id)->get()->toArray();
     //$subcategorias_lists = $subcategorias::lists('descricao', 'id');
     return Response()->json($subcategorias)->header('Access-Control-Allow-Origin', "*");
     //return Response()->make($subcategorias);
 }
开发者ID:brunnocaliman,项目名称:yeti,代码行数:7,代码来源:SubcategoriaController.php

示例2: index

 public function index()
 {
     $user = $this->user->selectAll();
     //dd($comment);
     //return Response()->json(['name' => 'Seild', 'state' => 'Hyed']);
     return Response()->json($user);
 }
开发者ID:331164885,项目名称:Laravel-Project,代码行数:7,代码来源:UsercenterController.php

示例3: index

 public function index()
 {
     //$comments = $this->comment->selectAll();
     //return Response()->json(['name' => 'Seild', 'state' => 'Hyed']);
     $commments = $this->comment->getAll();
     return Response()->json($commments);
 }
开发者ID:331164885,项目名称:Laravel-Project,代码行数:7,代码来源:CommentController.php

示例4: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @param  string|null  $guard
  * @return mixed
  */
 public function handle($request, Closure $next, $guard = null)
 {
     if (!Auth::check()) {
         return Response()->json(ResponseManager::getError('', 401, 'You are not authorized to access this. Plese login.'));
     }
     return $next($request);
 }
开发者ID:GaurangGhinaiya,项目名称:Laravel-Angular-Demo,代码行数:15,代码来源:Authenticate.php

示例5: handle

 public function handle($request, Closure $next)
 {
     if ($request->user() == null || !$request->user()->est_adm()) {
         return Response("Accès interdit");
     }
     return $next($request);
 }
开发者ID:Alex01723,项目名称:PTUT-CompetitionImage,代码行数:7,代码来源:AdminMiddleware.php

示例6: getCost

 public function getCost(Request $request)
 {
     $credentials = new Aws\Credentials\Credentials(env('AWS_KEY'), env('AWS_SECRET'));
     $client = Ec2Client::factory(array('credentials' => $credentials, 'version' => 'latest', 'region' => $request->input('region')));
     $terminate = Carbon::parse($request->input('terminateTime'));
     $terminateTime = Carbon::parse($request->input('terminateTime'));
     $terminate->minute = 00;
     $terminate->second = 00;
     $terminate->addHour();
     $launch = Carbon::parse($request->input('launchTime'));
     $launchTime = Carbon::parse($request->input('launchTime'));
     $launch->minute = 00;
     $launch->second = 00;
     //$client = \AWS::createClient('ec2');
     $result = $client->describeSpotPriceHistory(['AvailabilityZone' => $request->input('availabilityZone'), 'DryRun' => false, 'StartTime' => $launch, 'EndTime' => $terminate, 'InstanceTypes' => [$request->input('instanceType')], 'ProductDescriptions' => ['Linux/UNIX']]);
     $total_cost = 0.0;
     $total_seconds = $launch->diffInSeconds($terminate);
     $total_hours = $total_seconds / (60 * 60);
     $last_time = $terminate;
     $computed_seconds = 0;
     foreach ($result['SpotPriceHistory'] as $price) {
         $price['SpotPrice'] = floatval($price['SpotPrice']);
         $available_seconds = new Carbon($last_time = $price['Timestamp']);
         $available_seconds = $available_seconds->diffInSeconds(Carbon::createFromTimestamp(0));
         $remaining_seconds = $total_seconds - $computed_seconds;
         $used_seconds = min($available_seconds, $remaining_seconds);
         $total_cost = $total_cost + $price['SpotPrice'] / (60 * 60) * $used_seconds;
         $computed_seconds = $computed_seconds + $used_seconds;
         $last_time = $price['Timestamp'];
     }
     return Response(['TotalCost' => $total_cost, 'PaidHours' => $launch->diffInSeconds($terminate) / (60 * 60), 'ActualHours' => $launchTime->diffInSeconds($terminateTime) / (60 * 60)]);
 }
开发者ID:SamStenton,项目名称:AWS-Spot-EC2-Cost,代码行数:32,代码来源:AWSController.php

示例7: rncStad

 /**
  *Devuelve un pdf con todos los datos 
  *estadisticos del Reg, de tumores del año  
  *y del mes que se pase
  *responde a @GET /reporte/estadisticas/rncs
  */
 public function rncStad(Request $data)
 {
     //Reglas de validacion
     $rules = ['year' => 'required', 'mon' => 'required|numeric|min:1|max:12'];
     /*
      *Valida datos segun las reglas $rules
      *y genera mensajes segun $messages
      */
     $validator = Validator::make($data->all(), $rules, $this->messages);
     /*
      *Si hay error en los datos, 
      *regresa el primer mensaje de
      *error
      */
     if ($validator->fails()) {
         //Primer mensaje de error
         $errMessage = $validator->errors()->first();
         return Response()->json(['status' => 'danger', 'message' => $errMessage]);
     } else {
         $year = $data->year;
         $mon = '0' . $data->mon;
         $date = $year . '-' . $mon;
         $mons = ['ENERO', 'FEBRERO', 'MARZO', 'ABRIL', 'MAYO', 'JUNIO', 'JULIO', 'AGOSTO', 'SEPTIEMBRE', 'OCTUBRE', 'NOVIEMBRE', 'DICIEMBRE'];
         $mo = $mons[$mon - 1];
         $registers = DB::table('rncs')->where('fec_reg', 'like', $date . '%')->select('reg_rgn', 'nom_pri', 'nom_seg', 'ape_pri', 'ape_seg', 'sex', 'eda_adm', 'prc_edo', 'mun_prc', 'des_ltg', 'cod_ltg', 'sco_ltg', 'des_morf', 'cod_morf', 'fec_fall', 'qui_otra', 'num_his')->get();
         $man = DB::table('rncs')->where('fec_reg', 'like', $date . '%')->where('sex', 'MASCULINO')->count();
         $girl = DB::table('rncs')->where('fec_reg', 'like', $date . '%')->where('sex', 'FEMENINO')->count();
         $view = \View::make('pdfs.rncStad', compact('registers', 'year', 'mo', 'man', 'girl'))->render();
         $pdf = \App::make('dompdf.wrapper');
         $pdf->loadHTML($view)->setPaper('latter')->setOrientation('landscape');
         return $pdf->stream('invoice');
     }
 }
开发者ID:herodez,项目名称:oncologia,代码行数:39,代码来源:reposController.php

示例8: getsuma

 public function getsuma($valor1, $valor2)
 {
     $total = $valor1 + $valor2;
     $array = ['valor1' => $valor1, 'valor2' => $valor2, 'total' => $total];
     //return view('operacion.suma', compact('total','valor1', 'valor2'));
     //return view('operacion.suma');
     return Response()->json($array);
 }
开发者ID:slopcri,项目名称:Laravel_Local,代码行数:8,代码来源:OperacionController.php

示例9: get

 function get($query = null)
 {
     if ($query == null) {
         return false;
     }
     $search = new GlobalSearch();
     Response($search->do_search($query));
 }
开发者ID:neevan1e,项目名称:Done,代码行数:8,代码来源:search.controller.php

示例10: getDetailsPage

 /**
  * @param $idSKu
  * @return \Dingo\Api\Http\Response
  */
 public function getDetailsPage($idSKu)
 {
     $product = $this->integrator->getDetailPage($idSKu);
     if (!$product) {
         throw new StoreResourceFailedException('Product not found');
     }
     return Response()->json($product);
 }
开发者ID:rlacerda83,项目名称:ecommerce-api-gateway,代码行数:12,代码来源:ProductController.php

示例11: getFeaturedProducts

 /**
  * @param Request $request
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function getFeaturedProducts(Request $request)
 {
     try {
         $products = $this->integrator->getFeatureds($request);
         return Response()->json($products);
     } catch (\Exception $e) {
         throw new StoreResourceFailedException($e->getMessage());
     }
 }
开发者ID:rlacerda83,项目名称:ecommerce-api-gateway,代码行数:13,代码来源:ProductController.php

示例12: getWhoBougthAlsoBougth

 /**
  * @return \Symfony\Component\HttpFoundation\Response
  */
 public function getWhoBougthAlsoBougth(Request $request)
 {
     try {
         $recommendations = $this->integrator->getWhoViewAlsoView($request);
         return Response()->json($recommendations);
     } catch (\Exception $e) {
         throw new StoreResourceFailedException($e->getMessage());
     }
 }
开发者ID:rlacerda83,项目名称:ecommerce-api-gateway,代码行数:12,代码来源:RecommendationController.php

示例13: getForm

 public function getForm($id_campagne)
 {
     $campagne = Campagne::find($id_campagne);
     if ($campagne != null) {
         return view('image_creation', array('campagne' => $campagne));
     } else {
         return Response("Stop pirater");
     }
 }
开发者ID:Alex01723,项目名称:PTUT-CompetitionImage,代码行数:9,代码来源:ImageController.php

示例14: handle

 /**
  * Handle an incoming request.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  \Closure  $next
  * @return mixed
  */
 public function handle($request, Closure $next)
 {
     $api_key = Input::get('api_key');
     if ($api_key != '2') {
         return Response()->json(array('message' => 'There is no api key!'), 404);
     } else {
         return $next($request);
     }
 }
开发者ID:rakimuzikleri,项目名称:web-service-php,代码行数:16,代码来源:CheckApiKey.php

示例15: getDepartamento

 public function getDepartamento($id)
 {
     $insumo = Departamento::where('id', $id)->first();
     if (!$insumo) {
         return Response()->json(['status' => 'danger', 'menssage' => 'Este departamento no existe']);
     } else {
         return $insumo;
     }
 }
开发者ID:herodez,项目名称:Deposito,代码行数:9,代码来源:departamentosController.php


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