簡體   English   中英

Symfony2自動加載器找到文件,但沒有找到類

[英]Symfony2 autoloader found file but did not find class

我正在嘗試安裝沒有供應商的symfony2,並且在運行app_dev.php時我一直收到以下錯誤:

RuntimeException: The autoloader expected class "Symfony\Component\EventDispatcher\Event" to be defined in file "/var/www/caremonk/vendor/symfony/symfony/src/Symfony/Component/EventDispatcher/Event.php". The file was found but the class was not in it, the class name or namespace probably has a typo.

我通過以下方式安裝了正確的文件和供應商:php composer.phar update php composer.phar install

我還檢查了Symfony2抱怨的文件,文件的內容是:

<?php

/*
 * This file is part of the Symfony package.
 *
 * (c) Fabien Potencier <fabien@symfony.com>
 *
 * For the full copyright and license information, please view the LICENSE
 * file that was distributed with this source code.
 */

namespace Symfony\Component\EventDispatcher;

/**
 * Event is the base class for classes containing event data.
 *
 * This class contains no event data. It is used by events that do not pass
 * state information to an event handler when an event is raised.
 *
 * You can call the method stopPropagation() to abort the execution of
 * further listeners in your event listener.
 *
 * @author  Guilherme Blanco <guilhermeblanco@hotmail.com>
 * @author  Jonathan Wage <jonwage@gmail.com>
 * @author  Roman Borschel <roman@code-factory.org>
 * @author  Bernhard Schussek <bschussek@gmail.com>
 *
 * @api
 */
class Event
{
   // Some more code
}

這是一個我沒有觸及的標准symfony2類,所以我對我需要做的事情有點迷失。 我怎樣才能擺脫這個錯誤?

昨晚遇到了類似的問題。 禁用和重新啟用APC似乎可以解決問題。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM