我從模態輸入數據,並且表單操作在控制器上,如果它是真的/不是會話數據,我想發出警報。這樣,PHP重定向最近的頁面
$rules = [
'required' => [
['name'],['description']
]
];
$validate = Validation::check($rules,'post');
if(!$validate->auth){
$this->session->set_userdata('error', 'error!');
redirect('recentpagegoeshere');
}
如何重定向到最近的頁面,我無法使用header('location:...')
或redirect('to controller')
因爲頁面是基於最近的位置
你是什麼意思_「因爲頁面是基於最近的位置」 _你的最後一句話? – Mikey
@Mikey表單在template.blade.php(頁腳部分)上,因此用戶可以在網頁上的任何地方輸入數據,因爲它在模板上。 – Willy