Codeigniter路由不适用于参数

I have controller Post with methods index, add and delete. I create routes rule for this actions:

$route['posts'] = 'post/index'; // <-- Work 
$route['post-add'] = 'post/add';// <-- Work 
$route['post-delete/(:num)'] = 'post/delete/$1'; // <-- Not Work 

First route www.example.com/posts work good, and second with /post-add work. But when i call post-delete/5 that not work, all time i get 404 Not Fount.

Here is controller

class Post extends MY_Controller
{
     public function index()
     { 
         //.
     }

     public function add()
     { 
         //.
     }

     public function delete($id)
     { 
         echo "Delete post #ID =" $id;
     }
}

I have only problem with delete route i dont know whay he dont accept that parameter.

Work:

  • www.example.com/posts
  • www.example.com/add

Not work:

  • www.example.com/delete/1

What can be problem?

Add it to route file

$route['delete/(:num)'] = 'post/delete/$1'