简体   繁体   中英

Annotations in Symfony 4

I try to develop with Symfony 4 so I follow the tutorial on symfony.com

I've got an error when I try to access at :

http://localhost:8000/

This is the error :

[Syntax Error] Expected PlainValue, got ''' at position 7 in method App\\Controller\\HomeController::home() in /Users/ /Documents/ProjetSymfo4/my-project/config/routes/../../src/Controller/ (which is being imported from "/Users/ /Documents/ProjetSymfo4/my-project/config/routes/annotations.yaml"). Make sure annotations are installed and enabled.

I already ran

composer require annotations

And it is installed

In composer.json : 

"require": {
    "php": "^7.1.3",
    "ext-iconv": "*",
    "sensio/framework-extra-bundle": "^5.1",

This is my project :

在此处输入图片说明

I found the issue and how to fix it

As you can see on my screen I wrote

/**
* @Route('/')
*/

However to work we have to put " instead of '

/**
* @Route("/")
*/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM