【发布时间】:2016-09-01 09:43:39
【问题描述】:
我正在关注这个 Cron Job with Laravel 4 作为 laravel 4 中 cron 的教程,但它似乎不起作用。这是我的/app/commands/ReleaseOptionBooking.php
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class ReleaseOptionBooking extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'release:option';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Check booking expirations';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
$to = "bikegearup@gmail.com";
$subject = "My subject";
$txt = "Hello world!";
$headers = "From: admin@theskitrip.ca" . "\r\n";
mail($to,$subject,$txt,$headers);
}
/**
* 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),
);
}
}
这是/app/start/artisan.php
Artisan::add(new ReleaseOptionBooking);
在我服务器的crontab -e
*/10 * * * * php /var/www/myproject/protected/artisan release:option
有人知道我的案子吗?
我收到了这个错误:
[RuntimeException]
Not enough arguments.
release:option [--example[="..."]] example
【问题讨论】: