我正在尝试从URL中获取“id”,以便删除特定选定的产品。我已经使用了$this->uri->segment(3)
,但它没有从URL中获取任何值。尽管我可以在我的URL中看到“product_id”。
如果我使用$this->url->segment(2)
,它会给我URL中的第二个值,但我无法获取产品ID。
以下是我的代码。请指导我。
VIEW
echo "<a href='delete_controller?product_id=$product_id'>";
echo $name;
echo "</a>";
当我点击$name时,会生成以下URL。
http://localhost/designs2/index.php/products_controller/delete_controller?product_id=70
控制器
public function delete_controller()
{
echo $product_id =$this->uri->segment(3);
echo "Taha";
$this->load->view('delete_confirmation');
}