php artisan에서 커스텀 커맨드가 필요합니다.PHP Artisan Custom Command
장인 셸을 통해 명령 파일을 만들었습니다.
하지만 php artisan을 통해 실행하면 정의되지 않은 상태가됩니다.
내 명령에 인수를 추가하는 방법도 혼란 스럽습니다. 여기
내 전체 명령 파일입니다 : 당신은에 명령을 추가 할 필요가<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class createLibrarySet extends Command
{
/**
* The console command name.
*
* @var string
*/
protected $name = 'createLibrarySet';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Creates a Library Set.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$dir = mkdir(app_path()."/".library."/".$this->library_name);
$coreName = $this->library_name;
$serivceProvider = $coreName."."."ServiceProvider.php";
$library = $coreName."."."Library.php";
$facade = $coreName."."."Facade.php";
$interface = $coreName."."."Interface.php";
fopen($dir."/".$library, "w");
fopen($dir."/".$facade, "w");
fopen($dir."/".$serivceProvider, "w");
fopen($dir."/".$interface, "w");
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
array('example', InputArgument::REQUIRED, 'An example argument.'),
);
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
);
}
}
이 왜 파일 핸들을 캡처하는 데 실패 후 모든하면 fopen() 호출을하고있다 :
당신의 인수를 얻으려면, 당신은 단지에 있나요? 이러한 파일에 실제로 쓰려면 파일 핸들이 필요하며 모든 파일을 잃어 버릴 수 있습니다. –
해당 섹션이 불완전하지 않고 내 관심사가 아닙니다. 이제 숙련공 인터페이스와 관련이 있습니다. –