Lucky Controller 不工作,代码看起来正确

Lucky Controller is not working , Code is looking Correct

我遇到错误,而 运行 代码,附加的是错误和代码,那是行不通的。 提前致谢

Exception thrown when handling an exception (Symfony\Component\Config\Exception\FileLoaderLoadException: [Syntax Error] Expected PlainValue, got ''' at position 7 in method AppBundle\Controller\LuckyController::numberAction() in C:\xampp\php\hamad\src\AppBundle/Controller/ (which is being imported from "C:\xampp\php\hamad/app/config\routing.yml"). Make sure annotations are installed and enabled.)

代码:

//src/AppBundle/Controller/LuckyController
<?php

namespace AppBundle\Controller;

use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;

class LuckyController
{
    /**
     *@Route('lucky/number')
     */
     public function numberAction()
     {
         $number = random_int(0, 100);

         return new Response(
             '<html><body>Lucky number: '.$number.'</body></html>'
         );
     }
}

其实我用过

/**
     *@Route('lucky/number')
     */

而准确格式是

  /**
 * @Route("/lucky/number")
 */

已解决