wintersilence / kohana-cli

Kohana CLI 工作模块

dev-3.3/master 2020-05-20 18:56 UTC

This package is not auto-updated.

Last update: 2024-09-28 15:59:53 UTC


README

Kohana 框架 3.x 的 CLI 模块。

安装

DOCROOT/index.php 中替换 minion 模块

if (PHP_SAPI == 'cli')  {
  // replace this
}

// Check whether the module is connected
class_exists('CLI') || die('Please enable the `CLI` module.');
// Change exception handler
set_exception_handler(['CLI_Exception', 'handler']);

// Set CLI options
ignore_user_abort(TRUE);
ini_set('cli_server.color', 'on');

// Create and execute the main/initial task
CLI_Tasker::factory(CLI::option('task'), CLI::option())->execute();

在 Linux 中使用 ./cli./cli_daemon 来调用 CLI 任务。

关于使用更详细的信息,请参阅 guide

特点

  • 清洁且文档化的代码
  • 修复内存泄漏和输出错误
  • 模板任务