在 symfony2 中重新生成 autoload.php
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/20355069/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Regenerate autoload.php in symfony2
提问by benoffi7
I have autoload.php with this code
我有这个代码的 autoload.php
<?php
// autoload.php generated by Composer
require_once __DIR__ . '/composer' . '/autoload_real.php';
return ComposerAutoloaderInit8be239f5caef32db03f87bb271ed6012::getLoader();
but when I access to localhost
但是当我访问本地主机时
Fatal error: Class 'ComposerAutoloaderInit8be239f5caef32db03f87bb271ed6012' not found in /home/sebastian/Development/PHP/miciudad/vendor/autoload.php on line 10
Yesterday this work and I didn update.
昨天这项工作,我没有更新。
If I run php composer.phar installwill it work and generate the correct autoload.php?
如果我运行php composer.phar install它会工作并生成正确的autoload.php吗?
Thanks!
谢谢!
回答by undefined
It should. Also php composer.phar dump-autoloadshould do the job.
As stated in the docs:
这应该。也php composer.phar dump-autoload应该做这份工作。
如文档中所述:
If you need to update the autoloader because of new classes in a classmap package for example, you can use dump-autoload to do that without having to go through an install or update.
例如,如果由于类映射包中的新类而需要更新自动加载器,则可以使用 dump-autoload 来执行此操作,而无需进行安装或更新。

