Patroklo / codeigniter-static-laravel-routes

Integrates static laravel-like routes and filtering into codeigniter 3.x and 2.x
46 stars 21 forks source link

404 Page Not Found #2

Closed ngangchill closed 9 years ago

ngangchill commented 9 years ago

Controller: welcome.php public function index() { $this->load->view('welcome_message'); }

public function load($id){
    var_dump($id);
}

Route definition

Route::any('welcome/{id}',  'welcome/load/$1')->where('id', '/[0-9]+/');

when i use Route::pattern('id', '/[0-9]+/'); in route it shows 404 error.. or whenever i use ....->where('id', '/[0-9]+/') it shows same 404 error.without ->where('id', '/[0-9]+/') it works fine..

ngangchill commented 9 years ago

or if i use Route::any('welcome/load/{id?}', 'welcome/ok/$1')->where('id', '/[0-9]+/');

it shows : \

A PHP Error was encountered

Severity: Warning

Message: strpos(): Empty needle

Filename: libraries/Route.php

Line Number: 848

Backtrace:

File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\sites\test\application\libraries\Route.php Line: 848 Function: strpos

File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\sites\test\application\libraries\Route.php Line: 628 Function: make

File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\sites\test\application\libraries\Route.php Line: 119 Function: createRoute

File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\sites\test\application\routes\Route.php Line: 10 Function: any

File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\sites\test\application\core\MY_Router.php Line: 31 Function: include

File: C:\Program Files (x86)\EasyPHP-DevServer-14.1VC11\data\localweb\sites\test\index.php Line: 292 Function: require_once

with a 404 error...

Patroklo commented 9 years ago

Hi! Im from mobile, I'll come back Sunday from vacation, I'll check it then and try to see the error, sorry about the delay.

Patroklo commented 9 years ago

BUT from memory (can't try any example in this computer, it's not mine) the pattern may be like: Route::pattern('id', '[0-9]+'); without the / slashes (but as I have told... if that doesn't work, I'll check it sunday night or monday morning.

Patroklo commented 9 years ago

Hi, I have checked and it's as I said, you don't have to use the / slashes. It was my fault that the readme says otherwise. I'm going to change it right now. If it still doesn't work, just tell me.

And about the other error, I have changed a line in the library, now it should work without sending the warning.

ngangchill commented 9 years ago

thanks...

i will try it now...

ngangchill commented 9 years ago

thnx. everything is working fine...

Patroklo commented 9 years ago

Thanks about warning about the issues