gpt4 book ai didi

php - Laravel 3 和 Composer 找不到类

转载 作者:行者123 更新时间:2023-12-04 18:30:40 31 4
gpt4 key购买 nike

这个问题不太可能帮助任何 future 的访客;它仅与一个小地理区域、一个特定时刻或一个非常狭窄的情况相关,而这些情况通常不适用于互联网的全局受众。如需帮助使这个问题更广泛地适用,visit the help center .




9年前关闭。




我正在尝试使用 php-resque Composer 包通过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;
}
}

公共(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';

路径.php
片段
// --------------------------------------------------------------
// The path to the composer vendors directory.
// --------------------------------------------------------------
$paths['composer'] = 'vendor';

最佳答案

你错过了 DIRECTORY_SEPARATOR为您的 Composer 路径。

关于php - Laravel 3 和 Composer 找不到类,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15205949/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com