2012-02-01 22 views
2

好吧,我有控制器文件夾Codeignitor
一個應用程序,我有Codeignitor路線並不在子文件夾的工作

前/
管理員/選手/ players.php

球員/ admin和player.php文件夾是我的控制器。

當我嘗試訪問以下url我得到404錯誤。

http://localhost/mysite.com/admin/players/players

在routes.php文件我已經定義

$route['default_controller'] = "admin/login"; 
$route['admin/players'] = "admin/players/players"; 
$route['404_override'] = ''; 

但其示出了404錯誤。你能找到問題嗎?

+0

你是怎麼寫player.php的課程定義的?你能發佈它的前幾行嗎? players.php還有player()函數嗎? – Dev555 2012-02-01 17:25:46

+0

類玩家延伸是CI_Controller { \t \t 函數__construct() \t { 父:: __構建體(); } } – naeplus 2012-02-01 17:28:08

+0

它有player()函數嗎? – Dev555 2012-02-01 17:29:00

回答

0

這是您的整個控制器代碼?

class Players extends CI_Controller { function __construct() { parent::__construct(); } } 

如果是這樣,你缺少一個index(){}功能

localhost/mysite.com/admin/players被重定向到
localhost/mysite.com/admin/players/players具有基本與
localhost/mysite.com/admin/players/players/index

打破你的段是相同的,這意味着你需要一個控制器「players.php」放在你的「/ admin/players」目錄下,而且這個控制器需要一個「索引」功能。

相關問題