application\common.php文件內容如下:
return [
'app\shell\command\Test',
];
application\shell\command\Test.php內容如下:
namespace app\shell\command;
use think\console\Command;
use think\console\Input;
use think\console\Output;
use think\Db;
class Test extends Command
{
protected function configure()
{
parent::configure();
$this->setName('Test')->setDescription('Test');
}
protected function execute(Input $input, Output $output)
{
echo 'TestTestTestTest';exit;
}
}
切換到TP5根目錄,即../application/上級目錄(同級有個文件think)。
按住Shift鍵並且右擊鼠標,選擇‘在此處執行shell’。(或者直接cmd切換到該目錄),執行如下命令:
F:\x\www\PHPTutorial\php\php-5.6.27-nts\php.exe .\think Test