cakePHP
sample2.html
sample3.html
sample4.html
sample5.html
sample6.html
sample7.html
sample8.html
sample9.html
sample10.html
top blog
sample3.html
sample4.html
sample5.html
sample6.html
sample7.html
sample8.html
sample9.html
sample10.html
top blog
■sample1 cakePHP サンプル urlリスト
cakePHPはPHPのフレームワークです。DBに情報を格納するアプリケーションを、すばやく作れます。
ここではDBにコメントつきでurlをメモするアプリを作ります。
ちょこちょことプログラムを書くだけで、urlの一覧、詳細、更新、削除をするアプリケーションが完成します。
●DBのテーブルを作ります。
テーブル名は複数形にする。ここではurllistsとしました。
プライマリーキーはidとします。
必要なフィールドを定義します。ここでは,titleとurlとcommentを定義しました。
以下のフィールドを設定します。
・created DATETIME DEFAULT NULL,
・modified DATETIME DEFAULT NULL
●コントローラーを作ります。
テーブル名_controller.phpとします。
cake/app/controllers/urllists_controller.php
コントローラーは以下のとおりです。簡単です。
●モデルを作ります。
テーブル名の単数形がモデルの名前になります。 cake/app/models/urllist.php
モデルは以下のとおりです。簡単です。
以上でアプリケーションの完成です。
http://ホスト名/cake/urllist/index/
でアクセスできます。 サンプル1
http://ホスト名/cake/urllist/add/
でアクセスすると、新規データ入力画面になります。

データ入力後の画面です。 サンプル2
この画面で、一覧からデータを選んで、view(サンプル3)、edit,deleteが可能です。
CakePHP プログラマーズ リファレンスガイド