我想将我输入的malayalam文本保存到textarea到mysql。但是当我尝试接受表单提交中的malayalam内容时,它会返回ാീൂബഗഗജജ
个字符。但是我使用了utf-8编码。谁能帮我?我所做的代码如下:
public function import(Request $request) {
if ($request->hasFile('import_file')) {
$path = $request->file('import_file')->getRealPath();
$data = Excel::load($path, function($reader) {
})->get();
$randomNum = substr(str_shuffle("0123456789abcdefghijklmnopqrstvwxyz"), 0, 11);
$role_id = session('role_id');
if (!empty($data) && $data->count()) {
foreach ($data->toArray() as $key => $v) {
$insert[] = ['subid' => $v['subid'], 'totalanswers' => $v['totalanswers'],
'answer1' => $v['answer1'], 'answer2' => $v['answer2'], 'answer3' => $v['answer3'],
'answer4' => $v['answer4'], 'answer5' => $v['answer5'], 'question' => utf8_encode($v['question']), 'hint' => $v['hint'],
'questiontype' => $v['questiontype'], 'status' => $v['status'], 'questioncategory' => $v['questioncategory'],
'created_at' => $v['created_at'], 'updated_at' => $v['updated_at'], 'correctanswer' => $v['correctanswer'],
'role_id' => $role_id, 'tempid' => $randomNum
];
}
}
if (!empty($insert)) {
DB::table('questions_malayalam')->insert($insert);
session(array('randomid' => $randomNum));
return redirect(route('testquestion.order'));
}
}
Session::flash('message', "Please Check your file, Something is wrong there.");
return Redirect::back();
}
我需要其他语言的英语