Php FileLoaderException:无法导入资源“;mycontroller“;从「;C:/wamp/www/Symfony/app/config\routing.yml
我只是按照github上关于此捆绑包的单路由的教程: 但我在尝试加载我的主页时出错:Php FileLoaderException:无法导入资源“;mycontroller“;从「;C:/wamp/www/Symfony/app/config\routing.yml,php,symfony,routing,fosrestbundle,Php,Symfony,Routing,Fosrestbundle,我只是按照github上关于此捆绑包的单路由的教程: 但我在尝试加载我的主页时出错: FileLoaderException:无法从“C:/wamp/www/Symfony/app/config\routing.yml”导入资源“ADC\OgppBundle\Controller\OgppRestController”(无法为“ADC\OgppBundle\Controller\OgppRestController”标识的控制器确定类) 我知道这是一些基本的东西,但我不能让它工作。下面是代码
FileLoaderException:无法从“C:/wamp/www/Symfony/app/config\routing.yml”导入资源“ADC\OgppBundle\Controller\OgppRestController”(无法为“ADC\OgppBundle\Controller\OgppRestController”标识的控制器确定类)
我知道这是一些基本的东西,但我不能让它工作。下面是代码:
app/config/routing.yml
adc_rest:
resource: ADC\OgppBundle\Controller\OgppRestController
type: rest
ADC\OgppBundle\Controller\OgppRest.php
namespace ADC\OgppBundle\Controller;
use FOS\RestBundle\Controller\Annotations\View;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class OgppRestController extends Controller
{
public function getProfilesAction()
{
} // "get_profiles" [GET] /profile/all
public function getProfileAction($id)
{
} // "get_profile" [GET] /profile/{id}
}
编辑:我试图在开发环境中清除缓存,但当我这样做时,我遇到了同样的问题
希望这有帮助我不知道FOSRestBundle是如何工作的(我从未使用过),但我认为您的控制器文件名是错误的,应该是
OgppRestController.php
,而不是OgppRest.php您是对的!文件名是错误的……非常感谢!