我希望在提交表单后能够填充用户之前输入的内容。以下示例对我无效。请问是否有解决方案或更好的替代方法?
[查看]
[查看]
<input id="txtField" name="txtField" value="{{ old('txtField') }}"/>
<input type="submit" value="Submit">
[控制器]
public function showResults(){
$field = Request::input('txtField');
/* Note: "performQuery" is a private function
* that always returns a new view in the
* form: "view('some-view', compact('results'))" */
return $this->performQuery($field);
}
[路由]
Route::get('/View','Controller@loadPage');
Route::post('/View','Controller@showResults');
redirect()->withInput();
以便保留旧的输入内容。 - andrewtweber