LoginSignup
1
1

More than 5 years have passed since last update.

cakephp3 shell から controllerを使う

Posted at

これで シェルから、tweetscontroller を使うことができる。

CronShell.php


<?php
namespace App\Shell;

use Cake\Console\ConsoleOptionParser;
use Cake\Console\Shell;
use Cake\Log\Log;

use Cake\ORM\TableRegistry;
use App\Controller\TweetsController;

/**
 *
 *
 * Simple console wrapper around Psy\Shell.
 * /var/www/html/caba-ageha.com/bin/cake
 */
class CronShell extends Shell
{

    public function initialize()
    {
        parent::initialize();
        $this->Tweets = new TweetsController();
    }

    public function main(){

        $this->out($this->Tweets->video());

    }



//    cron を直接実行
// /opt/remi/php70/root/usr/bin/php -c /etc/opt/remi/php70/php.ini /var/www/html/twitube.jp/bin/cake.php cron


}



1
1
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
1
1