Last active
December 17, 2015 09:39
-
-
Save violetyk/5589293 to your computer and use it in GitHub Desktop.
[cakephp]ルーティング
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* /posts/123 -> $id | |
*/ | |
// routes.php | |
Router::connect('/posts/*', array('controller' => 'posts', 'action' => 'view')); | |
// PostsController | |
function view($id = null) { | |
} | |
// ---------- | |
// routes.php | |
Router::connect('/posts/:id', array('controller' => 'posts', 'action' => 'view'), array('id' => '[0-9]+')); | |
// PostsController | |
function view() { | |
$id = $this->params['id']; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment