2
我試圖通過artisan
使用php-resque
作曲程序包。我相信Laravel是v3.2.7。當運行命令php artisan queue
我得到的錯誤:在Laravel 3和Composer中找不到類別
錯誤
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 (queue.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';
paths.php 片段
// --------------------------------------------------------------
// The path to the composer vendors directory.
// --------------------------------------------------------------
$paths['composer'] = 'vendor';
某處是否包含路徑中的「Resque」?作曲家是否知道在哪裏可以找到它? – Halcyon 2013-03-04 16:16:40
我更新了原始文章以顯示我的'public/index.php'文件。它包含作曲家目錄'path('composer')'的路徑。這足夠嗎? – Nyxynyx 2013-03-04 16:17:53
你錯過了作曲家路徑的DIRECTORY_SEPARATOR ...但會認爲這會炸燬要求... – prodigitalson 2013-03-04 16:26:05