1.引入命令列檔案
fastadmin/application/command.php
2.在該位置新建執行檔案
此處以menu作說明
protected function configure()
{
$this
->setName('命令')
->addOption('引數1', '引數簡稱', Option::VALUE_REQUIRED (必填), '引數說明', 預設值)
->addOption('delete', 'd', Option::VALUE_OPTIONAL(選填), 'delete the specified menu', '')
->addOption('force', 'f', Option::VALUE_OPTIONAL, 'force delete menu,without tips', null)
->setDescription('命令說明');
//要執行的controller必須一樣,不適用模糊查詢
}
protected function execute(Input $input, Output $output)
{
//獲取引數
$equal = $input->getOption('force');
echo 'hello word!';
$output->info("Build Successed!");
}
php think crud -f aaa 即可輸出hello word,執行成功