当我评论插入查询时,返回工作。但查询返回不起作用。如果有人可以立即帮助,那将是很好的
public function regCustomer()
{
$arr = [];
$cus_name = Input::get('cusname');
$cus_address = Input::get( 'address' );
$cus_phone = Input::get( 'phone' );
$cus_email = Input::get( 'email' );
try{
DB::table('Customers')->insert(
array(
'customer_name' => $cus_name,
'address' => $cus_address,
'phone' => $cus_phone,
'email' => $cus_email
)
);
return 1;
}catch(Exception $ex){
return '0';
}
}
答案 0 :(得分:0)
替换catch块参数以匹配:
catch (\Illuminate\Database\QueryException $e)