我正在尝试php-resque
通过artisan
. 我相信 Laravel 是 v3.2.7。运行命令时php artisan queue
出现错误:
错误
PHP Fatal error: Class 'Resque' not found in /var/www/dev/application/tasks/queue.php on line 20
Fatal error: Class 'Resque' not found in /var/www/dev/application/tasks/queue.php on line 20
这里似乎有什么问题?php-resque 包似乎已安装到vendor
目录中...
PHP (队列.php)
class Queue_Task
{
public function run()
{
// Autoload composer vendors.
require path('composer').DS.'autoload.php';
// You can pass arguments into the worker as payload
$args = array('name' => 'John Smith');
Resque::enqueue('testqueue', 'ExampleWorker', $args);
echo "Resque job queued.\n";
return;
}
}
公共/index.php
// --------------------------------------------------------------
// Tick... Tock... Tick... Tock...
// --------------------------------------------------------------
define('LARAVEL_START', microtime(true));
// --------------------------------------------------------------
// Indicate that the request is from the web.
// --------------------------------------------------------------
$web = true;
// --------------------------------------------------------------
// Set the core Laravel path constants.
// --------------------------------------------------------------
require '../paths.php';
// --------------------------------------------------------------
// Autoload composer vendors.
// --------------------------------------------------------------
require path('composer').'autoload.php';
// --------------------------------------------------------------
// Unset the temporary web variable.
// --------------------------------------------------------------
unset($web);
// --------------------------------------------------------------
// Launch Laravel.
// --------------------------------------------------------------
require path('sys').'laravel.php';
// --------------------------------------------------------------
// Autoload composer vendors.
// --------------------------------------------------------------
require path('composer').DS.'autoload.php';
path.php 片段
// --------------------------------------------------------------
// The path to the composer vendors directory.
// --------------------------------------------------------------
$paths['composer'] = 'vendor';