cakephp2.doc_020
最終投稿日:2019年11月20日
ファイル名はキャメル形式+「Component.php」
例)
MytestComponent.php
<?php
//「extends Object」から「extends Component」へ変更
class MytestComponent extends Component {
//CakePHP2.3 以降は JAVA っぽく書くみたい。
public function initialize(Controller $controller) {
$this->controller = $controller;
}
//上記初期設定で「controller」にアクセスできる
※$this->controller->name で、このコンポーネントを処理している「controller」名が取得できる