Welcome Guest, Not a member yet? Register   Sign In
Passing URI Segments to your Functions
#1

[eluser]Gram3000[/eluser]
Hello,

I use the uri->segment() method a lot to pass variables to functions, for example:

Code:
$product_id = $this->uri->segment(3, 0);

Is the approach mentioned in the Codeigniter Controller documentation recommended instead using uri->segment()? Is it a safer or more optimized away to pass variables?

The example given in the documentation is :

Code:
<?php
class Products extends CI_Controller {

    public function shoes($sandals, $id)
    {
        echo $sandals;
        echo $id;
    }
}
?>




Theme © iAndrew 2016 - Forum software by © MyBB