http://kohana.loc/welcome/index/misha
Цитата (mmsgold @ 27.09.2015 - 18:03) |
так, скачаю я наверное другую версию kohana,,, эта 3.3.4 |
Цитата (mmsgold @ 27.09.2015 - 18:11) |
Invis1ble,http://kohana.loc/welcome/index/misha или весь класс kohana_route.php? |
Routes are used to determine the controller and action for a requested URI.
* Every route generates a regular expression which is used to match a URI
* and a route. Routes may also contain keys which can be used to set the
* controller, action, and parameters.
*
* Each <key> will be translated to a regular expression using a default
* regular expression pattern. You can override the default pattern by providing
* a pattern for the key:
*
* // This route will only match when <id> is a digit
* Route::set('user', 'user/<action>/<id>', array('id' => '\d+'));
*
* // This route will match when <path> is anything
* Route::set('file', '<path>', array('path' => '.*'));
*
* It is also possible to create optional segments by using parentheses in
* the URI definition:
*
* // This is the standard default route, and no keys are required
* Route::set('default', '(<controller>(/<action>(/<id>)))');
*
* // This route only requires the <file> key
* Route::set('file', '(<path>/)<file>(.<format>)', array('path' => '.*', 'format' => '\w+'));
*
* Routes also provide a way to generate URIs (called "reverse routing"), which
* makes them an extremely powerful and flexible way to generate internal links.
public static function set($name, $uri = NULL, $regex = NULL)
{
return Route::$_routes[$name] = new Route($uri, $regex);
}
protected static $_routes = array();
http://kohana.loc/welcome/index/misha, если ты об этом
Цитата (mmsgold @ 27.09.2015 - 17:55) |
Route::set('example','<controller>(/<action>(/<id>(/<new>))) 9;); |
<?php defined('SYSPATH') OR die('No direct script access.');
class Route extends Kohana_Route {}
Route::set('default', '(<controller>(/<action>(/<id>)))')
->defaults(array(
'controller' => 'welcome',
'action' => 'index',
));
Цитата |
кто нибудь может объяснить почему так работает public function action_index() { $id = $this->request->param('id'); $this->response->body('hello,'.$id); } а так уже нет public function action_index() { $user = $this->request->param('user'); $this->response->body('hello,'.$user); } |
Цитата (mmsgold @ 27.09.2015 - 18:48) |
Route::set('default', '(<controller>(/<action>(/<id>)))') |