-1
我正在使用laravel 4,我想使用我在https://laravel.com/docs/master/scheduling#introduction找到的任务计划,但由于某些原因,它不起作用。Laravel 4任务计划不能正常工作
[email protected] c:\xampp\htdocs\ski\theskitrip\protected
# php artisan schedule:run
[InvalidArgumentException]
There are no commands defined in the "schedule" namespace.
[email protected] c:\xampp\htdocs\ski\theskitrip\protected
我只是想知道,因为我按照文档中,我创建了.../app/Console/Kernel.php
这也是Kernel.php
<?php
namespace App\Console;
use DB;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Foundation\Console\Kernel as ConsoleKernel;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
\App\Console\Commands\Inspire::class,
];
/**
* Define the application's command schedule.
*
* @param \Illuminate\Console\Scheduling\Schedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function() {
DB::table('tb_applicants')->insert(array('fullname' => "Mar Binay", 'email' => "[email protected]"));
})->everyMinute();
}
}
内容没有任何人对我的情况下的想法?我不想使用cron,因为它非常棘手。
问题,是否需要创建类似于这个PHP工匠的时间表? https://laravel.com/docs/master/artisan
这些错误看起来与您的计划任务没有任何关联。它们是HTTP请求错误。你是否与工匠一起完成计划? – Devon
我对此感到困惑。我将修改我的问题 – gadss
Laravel 4没有'schedule:run'命令。在提到文档时,请确保您选择4.2而不是主人。师父指的是最新版本。 – Devon