Symfony2控制台命令

时间:2014-01-30 22:56:16

标签: php symfony command-line console

我关注了Symfony2 create a basic command line

<?php
// application.php

use Acme\Command\GreetCommand;
use Symfony\Component\Console\Application;

$application = new Application();
$application->add(new GreetCommand);
$application->run();

但我收到了错误:

  

致命错误:未找到类'Symfony \ Component \ Console \ Application'

1 个答案:

答案 0 :(得分:0)

根据http://symfony.com/doc/current/components/using_components.html,您需要将自动加载器包含在PHP脚本的顶部。

// update this to the path to the "vendor/"
// directory, relative to this file
require_once __DIR__.'/../vendor/autoload.php';