Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/288.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 移动应用程序有足够的API响应_Php_Laravel_Lumen - Fatal编程技术网

Php 移动应用程序有足够的API响应

Php 移动应用程序有足够的API响应,php,laravel,lumen,Php,Laravel,Lumen,我正在使用Laravel-Lumen为我的移动应用程序创建一个API,我有以下场景,我不知道返回对我的Android/IOS应用程序的响应的最充分的方式是什么 假设用户正在尝试登录(相同端点): 案例1:用户为登录提供正确的数据 案例2:用户使用错误的密码登录 案例3:用户不存在,必须先注册 我的问题是,我的API响应应该是什么样的,以便我能够在我的应用程序逻辑中区分这些情况,并相应地向前推进(我需要知道发生了哪种情况)?您的响应如下- Use this response if request

我正在使用Laravel-Lumen为我的移动应用程序创建一个API,我有以下场景,我不知道返回对我的Android/IOS应用程序的响应的最充分的方式是什么

假设用户正在尝试登录(相同端点):

案例1:用户为登录提供正确的数据

案例2:用户使用错误的密码登录

案例3:用户不存在,必须先注册


我的问题是,我的API响应应该是什么样的,以便我能够在我的应用程序逻辑中区分这些情况,并相应地向前推进(我需要知道发生了哪种情况)?

您的响应如下-

Use this response if request validated successfully. 
{"status":"OK", "message":"success"}

Use this response if user not exist.
{"status":"FAIL", "message":"not_register"}

Use this response for invalid credentials.
{"status":"FAIL", "message":"invalid_credentials"}

您的答复如下:

Use this response if request validated successfully. 
{"status":"OK", "message":"success"}

Use this response if user not exist.
{"status":"FAIL", "message":"not_register"}

Use this response for invalid credentials.
{"status":"FAIL", "message":"invalid_credentials"}

谢谢伙计,我将以整数值(状态代码)的形式跟踪状态谢谢伙计,我将以整数值(状态代码)的形式跟踪状态