Welcome Guest, Not a member yet? Register   Sign In
Understanding routes
#1

Hello, i'm new in CI and i just started my app.My question is about routes, if i have :

PHP Code:
$route['something/(:any)'] = 'Login/test/$1'

And if i request 'something' without anything, i must to make another route like this : $route['something'] = 'Login/test'; and finally to look like this:


PHP Code:
$route['something'] = 'Login/test/$1';

$route['something/(:any)'] = 'Login/test/$1'


[font=Monaco, Consolas, Courier, monospace]Or is another way to make this?[/font]

[font=Monaco, Consolas, Courier, monospace]My controller is:[/font]

PHP Code:
class Login extends CI_Controller{

    public function index(){
        $this->load->view('login_view');
    }
public function 
test(string $ceva){

        if(isset($ceva)){
            echo "avem setat {$ceva} <br />";
        }
        echo "sunt si aici";
    }

Reply


Messages In This Thread
Understanding routes - by bystefu - 01-04-2020, 04:15 AM
RE: Understanding routes - by littlej - 01-06-2020, 09:42 AM



Theme © iAndrew 2016 - Forum software by © MyBB