CakePHP情報のまとめ

Controllerの記述の基本形

http://.../xxx/でアクセスする場合、
class XxxController extends AppController {

    public $name = 'Xxx';          // コントローラ名
    public $uses = null;           // 使用するモデル名(未使用時は「null」)
    public $autoRender = false;    // 自動レンダリング機能のON/OFF

    function index() {
        // デフォルトページの処理
    }
}
ファイル名:xxx_controller.phpでapp/controllers/に保存する。

マニュアル

コントローラの属性(公式マニュアル)
http://book.cakephp.org/ja/view/51/Controller-Attr...

トップページのコントローラーを変更する

app/config/routers.php を変更する
Router::connect('/', array('controller' => 'pages', 'action' => 'display', 'home'));
Router::connect('/', array('controller' => 'home', 'action' => 'index'));
とすると app/controller/home_controller.phpのindex()が実行される



コメントをかく


「http://」を含む投稿は禁止されています。

利用規約をご確認のうえご記入下さい

Wiki内検索

フリーエリア

編集にはIDが必要です