通常在 CodeIgniter 中,每个控制器都有一个单独的控制器。所以,你有一个Users控制器和一个Game控制器。
当您需要对用户做某事时,您可以调用类似http://example.com/index.php/users/some_user_action游戏的 URL ( http://example.com/index.php/game/some_game_action)。
控制器可能看起来像
// codeigniter/application/controllers/users.php
class Users extends CI_Controller{
    function index(){
        echo "I'm the index page and can be reached at http://example.com/index.php/users";
    }
    function some_user_action(){
        echo "I'm some user action; see me at http://example.com/index.php/users/some_user_action";
    }
}
// codeigniter/application/controllers/game.php
class Game extends CI_Controller{
    function index(){
        echo "I'm the Game controller index page and can be reached at http://example.com/index.php/game";
    }
    function some_game_action(){
        echo "I'm some game action; see me at http://example.com/index.php/game/some_user_action";
    }
}
CodeIgniter 有很好的文档;值得一看。介绍教程是一个很好的起点:http ://ellislab.com/codeigniter/user-guide/tutorial/index.html另请参阅控制器页面:http ://ellislab.com/codeigniter/user-guide/general /controllers.html