LoginSignup
7
8

More than 5 years have passed since last update.

CakePHPのShellから別のShellを呼び出す

Last updated at Posted at 2014-07-13

dispatchShellをメソッドを使ってHogeOneShellからHogeTwoクラスのメソッドを呼ぶ

HogeOneShell.php
<?php
    class HogeOneShell extends AppShell{
        public function main(){
            // HogeTwoShell.phpのmainメソッドを呼び出す
            $this->dispatchShell('HogeTwo');

            // HogeTwoShell.phpのhogeMethodメソッドを呼び出す
            $this->dispatchShell('HogeTwo', 'hogeMethod');
        }
    }
?>

<?php
    class HogeTwoShell extends AppShell{
        public function main(){
            echo "HogeTwo main";
        }

        public function hogeMethod(){
            echo "HogeTwo hogeMethod";
        }
    }
?>

7
8
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
8