sensei。你能幫我用我的代碼嗎?我想在編輯之後將頁面重定向到同一頁面。如何在編輯數據後重定向到同一頁面?
這裏是我的控制器
function edit_book(){
$editBook = array(
'id' => $this->input->post('id'),
'book_title' => $this->input->post('book_title'),
'category' => $this->input->post('category'),
'author' => $this->input->post('author')
):
$this->m_profile->edit_book($data1, $data, 'book_data');
redirect('app/book')
}
假設IM編輯從頁碼3.數據我如何可以重定向到第3頁(應用程序/電子書/ 3)後再次提交編輯的數據?
我試圖通過獲取URI值來解決它(假設頁面是app/book/3)< - 我需要這個'3'來放置重定向代碼。所以我從許多stackeroverflow答案實現這個代碼,希望能得到一些陣列,我可以使用
$url = "//{$_SERVER['HTTP_HOST']}{$_SERVER['REQUEST_URI']}";
$escaped_url = htmlspecialchars($url, ENT_QUOTES, 'UTF-8');
$query_str = parse_url($escaped_url, PHP_URL_QUERY);
parse_str($query_str, $query_params);
print_r($query_params);
,但它會導致陣列()或空。任何人都可以幫助我。謝謝
可能重複[如何重定向到PHP中的同一頁](https://stackoverflow.com/questions/8130990/how-to-redirect-to-the-same-page-in-php) –
有你試過'$ _SERVER ['HTTP_REFERER']'? – Cashbee
你可以使用'$ config ['uri_segment']''在CI –