當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Authenticate::generateJsonResponse方法代碼示例

本文整理匯總了PHP中Authenticate::generateJsonResponse方法的典型用法代碼示例。如果您正苦於以下問題:PHP Authenticate::generateJsonResponse方法的具體用法?PHP Authenticate::generateJsonResponse怎麽用?PHP Authenticate::generateJsonResponse使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Authenticate的用法示例。


在下文中一共展示了Authenticate::generateJsonResponse方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionAuthenticate

 public function actionAuthenticate()
 {
     $model = new Authenticate();
     $authenticate_json = http_get_request_body();
     //$authenticate_json = json_encode(array("username"=>"kailesh","password"=>"1c3dd8b850b055bb7b6fb0fb59a7cd4","deviceID"=>"90:C1:15:BC:97:4F"));
     $model->verifyDetails($authenticate_json);
     $verification = $model->getAccess();
     $responseMsg = $model->generateJsonResponse();
     //var_dump($responseMsg);
     /*HttpResponse::status(200);
     		HttpResponse::setContentType('text/HTML');
     		HttpResponse::setData("Orders Recieved");
     		HttpResponse::send();*/
     //var_dump($responseMsg);
     if ($verification === true) {
         HttpResponse::status(200);
         HttpResponse::setContentType('application/json');
         HttpResponse::setData($responseMsg);
         HttpResponse::send();
     } else {
         HttpResponse::status(200);
         HttpResponse::setContentType('application/json');
         HttpResponse::setData($responseMsg);
         HttpResponse::send();
     }
 }
開發者ID:nsawant942,項目名稱:Canteen-Management-Software-System--Witwatersrand,代碼行數:26,代碼來源:MobileController.php

示例2: testUnknownUser

 public function testUnknownUser()
 {
     $authenticate = new Authenticate();
     $authenticate_json = json_encode(array("username" => "bob", "password" => "1c3dd8b823we055bb7b6fb0fb59a7cd04", "deviceID" => "85:D5:76:AA:97:4F"));
     $authenticate->verifyDetails($authenticate_json);
     $expected_response = json_encode(array("access" => false, "reason" => "RMB-01", "balance" => "0"));
     $returned_response = $authenticate->generateJsonResponse();
     $this->assertEquals($expected_response, $returned_response);
 }
開發者ID:nsawant942,項目名稱:Canteen-Management-Software-System--Witwatersrand,代碼行數:9,代碼來源:AuthenticationTest.php


注:本文中的Authenticate::generateJsonResponse方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。