【发布时间】:2015-10-06 16:01:35
【问题描述】:
我在 cpanel 中设置了一个 cronjob,我使用的是 laravel 4.2。我还设置将 cronjob 发送到我的电子邮件,黄色部分下方是我在电子邮件中收到的错误。
[无效参数异常]
“用户”命名空间中没有定义命令。
//laravel 命令.php
<?php
use Illuminate\Console\Command;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Input\InputArgument;
class CronDelFilesCommand extends Command {
/**
* The console command name.
*
* @var string
*/
protected $name = 'user:active';
/**
* The console command description.
*
* @var string
*/
protected $description = 'Command description.';
/**
* Create a new command instance.
*
* @return void
*/
public function __construct()
{
parent::__construct();
}
/**
* Execute the console command.
*
* @return mixed
*/
public function fire()
{
echo "aaa";
}
/**
* Get the console command arguments.
*
* @return array
*/
protected function getArguments()
{
return array(
);
}
/**
* Get the console command options.
*
* @return array
*/
protected function getOptions()
{
return array(
array('example', null, InputOption::VALUE_OPTIONAL, 'An example option.', null),
);
}
}
//cpanel中的命令
* * * * * /usr/bin/php /home/project/public_html/artisan user:active > /home/project/public_html/log.txt
怎么了?错误是什么意思?
更新
感谢@KristianHareland,我使用 wget。 :)
【问题讨论】:
-
尝试使用
wget http://www.website.tld/path/to/file我在 cPanel cron 作业中也遇到了一些问题,并认为这是最好的解决方法。 -
@KristianHareland 不再使用 laravel 命令了吗?
-
@KristianHareland 谢谢!
-
没问题,好好的:)