在读取从android应用发布到laravel方法的数据时遇到麻烦。
我发布的android代码
HttpClient httpclient = new DefaultHttpClient();
HttpPost httppost = new HttpPost(Constants.SAVE_DETAILS_END_POINT);
try {
List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
nameValuePairs.add(new BasicNameValuePair("name1", name1));
nameValuePairs.add(new BasicNameValuePair("name2", name2));
....
..
httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));
HttpResponse response = httpclient.execute(httppost);
}
catch(...
还有我的Laravel代码,
public function saveDetails(Request $request){
$modlee = new ModelName();
$modlee->name1 = $request->get('name1');
$modlee->name2 = $request->get('name2');;
...
$modlee->save();
return $modlee;
}
我尝试var_dump($request->get('name1'));
为空
总是出现错误,不能插入空值,违反MySQL完整性约束错误,