首页 文章

Laravel 3和Composer找不到的类[关闭]

提问于
浏览
2

我试图通过 artisan 使用 php-resque 作曲家包 . 我相信Laravel是v3.2.7 . 运行命令 php artisan queue 时出现错误:

Error

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;
    }
}

public/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';

1 回答

  • 2

    你错过了作曲家路径 DIRECTORY_SEPARATOR .

相关问题