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


PHP Controller::returnJson方法代码示例

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


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

示例1: postSendsms

 public function postSendsms(Request $request)
 {
     $mobile = Input::get('mobile');
     if (!preg_match("/1[3458]{1}\\d{9}\$/", $mobile)) {
         // if(!preg_match("/^13\d{9}$|^14\d{9}$|^15\d{9}$|^17\d{9}$|^18\d{9}$/",$mobile)){
         //手机号码格式不对
         return parent::returnJson(1, "手机号码格式不对" . $mobile);
     }
     $data = DB::select("select * from members where lifestatus=1 and mobile =" . $mobile);
     if (sizeof($data) > 0) {
         return parent::returnJson(1, "手机号已注册");
     }
     $checkCode = parent::get_code(6, 1);
     Session::put("m" . $mobile, $checkCode);
     $checkCode = Session::get("m" . $mobile);
     Log::error("sendsms:session:" . $checkCode);
     $msg = "尊敬的用户:" . $checkCode . "是您本次的短信验证码,5分钟内有效.";
     // Input::get('msg');
     $curl = new cURL();
     $serverUrl = "http://cf.lmobile.cn/submitdata/Service.asmx/g_Submit";
     $response = $curl->get($serverUrl . "?sname=dlrmcf58&spwd=ZRB2aP8K&scorpid=&sprdid=1012818&sdst=" . $mobile . "&smsg=" . rawurlencode($msg . "【投贷宝】"));
     $xml = simplexml_load_string($response);
     echo json_encode($xml);
     //$xml->State;
     //  <CSubmitState xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://tempuri.org/">
     //   <State>0</State>
     //   <MsgID>1512191953407413801</MsgID>
     //   <MsgState>提交成功</MsgState>
     //   <Reserve>0</Reserve>
     // </CSubmitState>
     // <State>1023</State>
     //  <MsgID>0</MsgID>
     //  <MsgState>无效计费条数,号码不规则,过滤[1:186019249011,]</MsgState>
     //  <Reserve>0</Reserve>
 }
开发者ID:jacke121,项目名称:tdbasset,代码行数:35,代码来源:AreaController.php

示例2: postLogin

 public function postLogin(Request $request, Route $route)
 {
     Log::error('postlogin:');
     //调用validate验证前端数据
     if (empty($request->get('name'))) {
         return parent::returnJson(1, "用户名不能为空");
     }
     if (empty($request->get('password'))) {
         return parent::returnJson(1, "用户名不能为空");
     }
     $credentials = $request->only('name', 'password');
     Log::error('login:' . $request->get('name') . "password" . $request->get('password'));
     //过滤掉前端数据,只留下name和password
     if ($this->auth->attempt($credentials, $request->has('remember'))) {
         return parent::returnJson(0, "登录成功");
     }
     return parent::returnJson(1, "用户名或密码错误");
     //调用validate验证前端数据
     //                  $name = Input::get('name');
     // $member->email = $member->name ."126.com";// Input::get('email');
     // $password ='123456';// Hash::make(Input::get('password'));
     //                $password =Input::get('password');
     Log::error("backendgetLogin: " . $name . $password);
     //                 $this->validate($request, ['name'=> 'required', 'password'=> 'required']);
     //                $credentials = $request->only('name', 'password');//过滤掉前端数据,只留下email和password
     //                  if($this->auth->attempt(array( 'name'=>$name,'password' =>$password))) {
     // if ($this->auth->attempt($credentials, $request->has('remember')))//重点就是这一个attempt方法,这个就是验证用户数据数据和数据库数据作比较的流程
     //                 {
     //                   Log::error("getLogin1");
     //                       return redirect()->intended("backend/home");//验证通过则跳入主页
     //                     // return redirect()->intended($this->redirectPath());//验证通过则跳入主页
     //                 }
     //               return redirect($request->back())//$this->loginPath())
     //                           //withInput(),负责数据写入session
     //                           ->withInput($request->only('name', 'password'))//验证失败,即输入数据和数据库数据不一致,携带错误信息返回到登录界面
     //                            ->withErrors([
     //                               'name'=> $this->getFailedLoginMessage(),
     //                            ]);
 }
开发者ID:jacke121,项目名称:tdbasset,代码行数:39,代码来源:AuthController.php

示例3: postModifypwd

 public function postModifypwd(Request $request)
 {
     //更新密码
     $array = ["password" => Hash::make($request->get('password'))];
     if (!empty($request->get('mobile'))) {
         if (Member::where('mobile', $request->get('mobile'))->update($array)) {
             $member_log = new Member_log();
             $member_log->ip = $request->getClientIp();
             $member_log->memberid = Session::get('memberd');
             $member_log->action = "forgetpwd";
             $member_log->type = 1;
             $member_log->save();
             return parent::returnJson(0, "密码修改成功");
         }
     } else {
         if (Member::where('id', $this->auth->get()->id)->update($array)) {
             $member_log = new Member_log();
             $member_log->ip = $request->getClientIp();
             $member_log->memberid = $this->auth->get()->id;
             $member_log->action = "changepwd";
             $member_log->type = 1;
             $member_log->save();
             return parent::returnJson(0, "密码修改成功");
         }
     }
     return parent::returnJson(1, "密码修改失败");
 }
开发者ID:jacke121,项目名称:tdbasset,代码行数:27,代码来源:AuthController.php

示例4: postAuthecompany

 public function postAuthecompany(Request $request)
 {
     $cart = parent::movefile($request, "company");
     if ($cart['status'] == 1) {
         return parent::returnJson(1, $cart['msg']);
     } else {
         $cardnourl = $cart['msg'];
     }
     // $this->validate($request, ['itemname' => 'required|min:3', 'email' =>'required','no'=>'required']);
     $member = new Member();
     $member->id = $this->auth->get()->id;
     $member->type = 2;
     $member->authestatus = 1;
     $member->cardnourl = $cardnourl;
     $member->address = $request->get('address');
     $member->addresscode = $request->get('addresscode');
     $member->roletype = $request->get('roletype');
     $member->itemname = $request->get('itemname');
     $member->email = $request->get('email');
     $member->cardno = $request->get('cardno');
     $member->updatememberInfo($member->id, $member);
     return parent::returnJson(0, "提交成功");
 }
开发者ID:jacke121,项目名称:tdbasset,代码行数:23,代码来源:AuthenticateController.php


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