public function runConsole() { defined('STDIN') or define('STDIN', fopen('php://stdin', 'r')); defined('STDOUT') or define('STDOUT', fopen('php://stdout', 'w')); defined('STDERR') or define('STDERR', fopen('php://stderr', 'w')); if (!is_array($this->appConfig)) { echo "You must load your Console configure file in ./cmd"; exit; } $application = new yii\console\Application($this->appConfig); $exitCode = $application->run(); exit($exitCode); }
<?php /** * Скрипт принимает и обрабатывает уведомления от PayQR */ defined('YII_DEBUG') or define('YII_DEBUG', true); defined('YII_ENV') or define('YII_ENV', 'dev'); require __DIR__ . '/../vendor/autoload.php'; require __DIR__ . '/../vendor/yiisoft/yii2/Yii.php'; require __DIR__ . '/../common/config/bootstrap.php'; require __DIR__ . '/../console/config/bootstrap.php'; $config = yii\helpers\ArrayHelper::merge(require __DIR__ . '/../common/config/main.php', require __DIR__ . '/../common/config/main-local.php', require __DIR__ . '/../console/config/main.php', require __DIR__ . '/../console/config/main-local.php'); $application = new yii\console\Application($config); $exitCode = $application->run(); require_once __DIR__ . "/PayqrConfig.php"; // подключаем основной класс //инициализируем данными нашу библиотеку if (PayqrConfig::init()) { exit("Error init PayQR market!"); } try { $receiver = new PayqrReceiver(); $receiver->handle(); } catch (PayqrExeption $e) { echo $e->response; } exit($exitCode);
#!/usr/bin/env php <?php define('ROOT', realpath(__DIR__ . DIRECTORY_SEPARATOR . '..')); require_once ROOT . '/vendor/autoload.php'; require ROOT . '/vendor/yiisoft/yii2/Yii.php'; $app = new \yii\console\Application(require "config.php"); $app->run();
#!/usr/bin/env php <?php /** * Yii console bootstrap file. */ require __DIR__ . '/vendor/autoload.php'; $env = new \xapon\YiiEnvironment\Environment(null, __DIR__ . '/config'); $env->setup(); $app = new yii\console\Application($env->configConsole); $exitCode = $app->run(); exit($exitCode);
<?php defined('APP_CACHE_PREFIX') or define('APP_CACHE_PREFIX', 'JB-9939-COM_'); //缓存前缀 defined('CACHE_AD_TIME') or define('CACHE_AD_TIME', 24 * 3600); defined('YII_DEBUG') or define('YII_DEBUG', false); defined('YII_ENV') or define('YII_ENV', 'dev'); defined('YII_ENV_DEV') or define('YII_ENV_DEV', YII_ENV === 'dev'); if (YII_ENV_DEV) { defined('YII_DB_ENV') or define('YII_DB_ENV', '-local'); defined('YII_LIB_PATH') or define('YII_LIB_PATH', '/data/lib/lib-yii2-framework/'); defined('PROJECT_PATH') or define('PROJECT_PATH', '/data/www/develop/code/trunk/admin-9939-com/frontend/web/'); //defined('YII_LIB_PATH') or define('YII_LIB_PATH','E:/web/php/develop/code/trunk/lib-yii2-framework/'); //defined('PROJECT_PATH') or define('PROJECT_PATH', 'E:/web/php/develop/code/trunk/admin-9939-com/frontend/web/'); } else { defined('YII_DB_ENV') or define('YII_DB_ENV', ''); defined('YII_LIB_PATH') or define('YII_LIB_PATH', '/data/web/framework/lib-yii2-framework/'); defined('PROJECT_PATH') or define('PROJECT_PATH', '/data/web/jb-9939-com/frontend/web/'); } require YII_LIB_PATH . '/autoload.php'; require YII_LIB_PATH . '/yiisoft/yii2/Yii.php'; require __DIR__ . '/../config/bootstrap.php'; $config = yii\helpers\ArrayHelper::merge(require __DIR__ . '/../../common/config/db/db_jbv2' . YII_DB_ENV . '.php', require __DIR__ . '/../../common/config/db/db_portal' . YII_DB_ENV . '.php', require __DIR__ . '/../../common/config/db/db_v2' . YII_DB_ENV . '.php', require __DIR__ . '/../../common/config/db/db_v2sns' . YII_DB_ENV . '.php', require __DIR__ . '/../../common/config/db/db_all' . YII_DB_ENV . '.php', require __DIR__ . '/../config/main' . YII_DB_ENV . '.php'); $application = new yii\console\Application($config); $application->run();