file_get_contentsより早い
App::uses('HttpSocket', 'Network/Http');
class hogeComponent extends Component {
function hogehoge($url, $query) {
$sock = new HttpSocket();
$res = $sock->get($url, $query);
return $res['body'];
}
}
定数
リクエストパラメータ
実行中コントローラー名の取得
$this->name
実行中アクション名の取得
$this->action
POST値取得
$this->request->data
GET値取得
$this->request->query
コントローラ名以下のURLを配列で取得
$this->request->pass
マイグレーション
スキーマテーブル作成
app/Console/cake Schema create
テーブル内容を手動で変更後、マイグレーションへ反映
app/Console/cake Migrations.migration generate -f
スキーマファイルに従い更新
app/Console/cake Schema update