1

我的问题是关于 codeigniter 的路线,我正在使用它,并且我为每个函数编写了路线。当我放最后一条路线时,这条路线不起作用,它给了我 404 错误。我不知道为什么?也许我在路线顺序上做错了,但我认为是对的。这是我的路线:

 //MATCH SHARE
// route not working 
    $routes['upload_image/upload_photo'] = "upload_image/upload_photo"; 

//all route working
    //VOTATION//
    $route['auth_social/fblogin'] = "auth_social/fblogin";
    $route['votation/user_plus/(:any)'] = "votation/user_plus";
    $route['votation/user_minum/(:any)'] = "votation/user_minum";



    $route['finish_registration/(:any)/(:any)'] = "auth/activate"; // activate e-mail
    $route['auth'] = "auth"; // index auth
    $route['register'] = "auth/register";
    $route['login'] = "auth/login"; // login
    $route['logout'] = "auth/logout";
    $route['default_controller'] = "auth/register"; // register

    $route['(:any)'] = "profile/user";

    $route['404_override'] = '';

htaccess

RewriteEngine on
RewriteCond $1 !^(index\.php|resources|robots\.txt)
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [L]
4

2 回答 2

0

你的变量是错误的 $routes,应该是 $route['upload_image/upload_photo'] = "upload_image/upload_photo";

于 2014-02-15T17:07:03.720 回答
0

尝试:

$routes['upload_image/upload_photo/?']    = "upload_image/upload_photo";
$routes['upload_image/upload_photo/(.+)'] = "upload_image/upload_photo/$1";

如果您需要额外的 uri 段,则当前的段将不起作用。

于 2013-08-20T08:20:52.283 回答