后端开发|php教程
laravel-5,php,ios
后端开发-php教程
iOS端代码如下:
html测边菜单源码,vscode开启自动保存,ubuntu 缺少pip,tomcat编码格式在哪,sqlite删除数据库列,楼道里的小爬虫怎么能去掉呢,php 移动 源码,网站seo优化基本操作,手机网站素材网,类模板静态函数lzw
AFHTTPRequestOperationManager *manage = [[AFHTTPRequestOperationManager alloc]initWithBaseURL:[NSURL URLWithString:@"http://localhost:8000/login/signin"]];manage.requestSerializer = [AFJSONRequestSerializer serializer];manage.responseSerializer = [AFJSONResponseSerializer serializer];[manage.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];manage.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/plain", @"text/javascript", @"text/json", @"text/html", nil];[manage POST:@"login/signin" parameters:[self.myLogin toParams] success:^(AFHTTPRequestOperation *operation, id responseObject) { DebugLog(@"\n===========response===========\n%@:\n%@", @"login/signin", responseObject); [_activityIndicator stopAnimating]; _loginButton.enabled = YES; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { DebugLog(@"\n===========response===========\n%@:\n%@", @"login/signin", error); [_activityIndicator stopAnimating]; _loginButton.enabled = YES; }];
Laravel的代码如下:
qq社区业务源码,vscode在哪里保存,u盘 装ubuntu,tomcat云服务器,Sqlite没有函数,网页设计中绿色的运用,phpcms 链接数据库,万维网服务器 如何发布服务,ping插件,前端框架使用占比,公积金爬虫,php 输出函数,seo引擎优化软件,springboot成品,html 文字 标签,仿淘宝网站html,手机网页psd素材,赶集网公司创建模板,dedecms后台管理中心模板,html页面插入优酷视频,银行管理系统 java,易语言生成程序win7无法使用lzw
routes.php----------Route::post(login/signin,[ as=>signin,uses=>Login\LoginController@signin]);LoginController.php----------public function signin(){$message = "登录成功"; $data = array(phone=>13800138000,password=>123456); $code = 0; return response()->json([message=>$message,data=>$data,code=>0]);}
提示错误:Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x7fe00d90a3a0 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
流量宝源码,vscode怎么跳转函数,ubuntu个人用,tomcat设置定时启动,爬虫会计资料,php跳出while循环,大余县seo优化公司,html5 网站案例,wordpress 汽车 模板lzw
但是将Route::post 改成 Route::get
manage POST:@”login/signin” 改成 manage GET:@”login/signin”
可以返回数据如下:
{ code = 0; data ={ password = 123456; phone = 13800138000; }; message = "\U767b\U5f55\U6210\U529f";}
请问问题出在哪里,求帮助,谢谢各位:D 。
使用Paw查看POST数据会出现php错误如下:
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid thiswarning set always_populate_raw_post_data to -1 in php.ini and use the php://input stream instead. in Unknown on line 0Warning: Cannot modify header information - headers already sent in Unknown on line 0
回复内容:
iOS端代码如下:
AFHTTPRequestOperationManager *manage = [[AFHTTPRequestOperationManager alloc]initWithBaseURL:[NSURL URLWithString:@"http://localhost:8000/login/signin"]];manage.requestSerializer = [AFJSONRequestSerializer serializer];manage.responseSerializer = [AFJSONResponseSerializer serializer];[manage.requestSerializer setValue:@"application/json" forHTTPHeaderField:@"Accept"];manage.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/plain", @"text/javascript", @"text/json", @"text/html", nil];[manage POST:@"login/signin" parameters:[self.myLogin toParams] success:^(AFHTTPRequestOperation *operation, id responseObject) { DebugLog(@"\n===========response===========\n%@:\n%@", @"login/signin", responseObject); [_activityIndicator stopAnimating]; _loginButton.enabled = YES; } failure:^(AFHTTPRequestOperation *operation, NSError *error) { DebugLog(@"\n===========response===========\n%@:\n%@", @"login/signin", error); [_activityIndicator stopAnimating]; _loginButton.enabled = YES; }];
Laravel的代码如下:
routes.php----------Route::post(login/signin,[ as=>signin,uses=>Login\LoginController@signin]);LoginController.php----------public function signin(){$message = "登录成功"; $data = array(phone=>13800138000,password=>123456); $code = 0; return response()->json([message=>$message,data=>$data,code=>0]);}
提示错误:Error Domain=NSCocoaErrorDomain Code=3840 "The operation couldn’t be completed. (Cocoa error 3840.)" (JSON text did not start with array or object and option to allow fragments not set.) UserInfo=0x7fe00d90a3a0 {NSDebugDescription=JSON text did not start with array or object and option to allow fragments not set.}
但是将Route::post 改成 Route::get
manage POST:@”login/signin” 改成 manage GET:@”login/signin”
可以返回数据如下:
{ code = 0; data ={ password = 123456; phone = 13800138000; }; message = "\U767b\U5f55\U6210\U529f";}
请问问题出在哪里,求帮助,谢谢各位:D 。
使用Paw查看POST数据会出现php错误如下:
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid thiswarning set always_populate_raw_post_data to -1 in php.ini and use the php://input stream instead. in Unknown on line 0Warning: Cannot modify header information - headers already sent in Unknown on line 0
phpinfo() 知道 always_populate_raw_post_data 修改成为-1即可