<?php
class Routes_demo extends CI_Controller {
	// http://127.0.0.1:8000/CodeIgniter-3.0.0/index.php/routes_demo
	public function index() {
		echo 'routes_demo index ';
	}
	
	// 路由配置目录 application/config/routes.php
	
	// 原地址: http://127.0.0.1:8000/CodeIgniter-3.0.0/index.php/routes_demo/show/2
	// 路由映射地址:
	// http://127.0.0.1:8000/CodeIgniter-3.0.0/index.php/news/2.html
	// $route['news/([\d]+)\.html']='routes_demo/show/$1';
	// http://127.0.0.1:8000/CodeIgniter-3.0.0/index.php/news/201515/2.html
	// $route['news/[\d]{6}/([\d]+)\.html']='routes_demo/show/$1';
	public function show($id = 0) {
		echo '这是文章' . $id;
	}
	
	// 原地址:
	// http://127.0.0.1:8000/CodeIgniter-3.0.0/index.php/routes_demo/showTwice/4/.jpg
	// 路由映射地址:
	// http://127.0.0.1:8000/CodeIgniter-3.0.0/index.php/news/201501/4/.jpg
	// $route['news/[\d]{6}/([\d]+)/([^\s]+)']='routes_demo/showTwice/$1/$2';
	public function showTwice($id = 0, $res = '') {
		echo '这是文章' . $id . $res;
	}
}