已采纳回答 / 慕妹7422820
在使用$error时需要用到中间件:\Illuminate\Session\Middleware\StartSession::class,\Illuminate\View\Middleware\ShareErrorsFromSession::class,
2018-01-24
Session::put不行的原因是没有在上面加上 use Illuminate\Support\Facades\Session;
老师用的是phpstorm,比较智能会自动添加use的
ps:各位赶紧去换个phpstorm吧.....不然这种事情会经常发生的
老师用的是phpstorm,比较智能会自动添加use的
ps:各位赶紧去换个phpstorm吧.....不然这种事情会经常发生的
2018-01-16
/**
* 获取当前时间
*
* @return int
*/
public function freshTimestamp() {
return time();
}
/**
* 避免转换时间戳为时间字符串
*
* @param DateTime|int $value
* @return DateTime|int
*/
public function fromDateTime($value)
{
return $value;
}
* 获取当前时间
*
* @return int
*/
public function freshTimestamp() {
return time();
}
/**
* 避免转换时间戳为时间字符串
*
* @param DateTime|int $value
* @return DateTime|int
*/
public function fromDateTime($value)
{
return $value;
}
2018-01-14
update报错"Call to a member function format() on string"
2018-01-14
messageblade代码
@if(\Illuminate\Support\Facades\Session::has('success'))
<div class="alert alert-success alert-dismissible" role="alert">
省略
<strong>成功!</strong>{{\Illuminate\Support\Facades\Session::get()}}
</div>@endif
@if(\Illuminate\Support\Facades\Session::has('success'))
<div class="alert alert-success alert-dismissible" role="alert">
省略
<strong>成功!</strong>{{\Illuminate\Support\Facades\Session::get()}}
</div>@endif
2018-01-11
studentcontrtoller代码
if (Student::create($data)) {
return redirect('student/index')->with('success', '添加成功!');
} else {
return redirect()->back()->with('error', '添加失败!');;
}
if (Student::create($data)) {
return redirect('student/index')->with('success', '添加成功!');
} else {
return redirect()->back()->with('error', '添加失败!');;
}
2018-01-11
将路由的的中间键删掉 还是没有显示成功的消息
不删也不行
版本5.2.45
Route::group([],function (){
Route::get('student/index',['uses'=>'StudentController@index']);
Route::any('student/create',['uses'=>'StudentController@create']);
Route::any('student/save',['uses'=>'StudentController@save']);
});
不删也不行
版本5.2.45
Route::group([],function (){
Route::get('student/index',['uses'=>'StudentController@index']);
Route::any('student/create',['uses'=>'StudentController@create']);
Route::any('student/save',['uses'=>'StudentController@save']);
});
2018-01-11