douxuanwei1980 2018-07-05 11:18
浏览 99
已采纳

Lucky Controller无法运行,Code看起来很正确

I am facing the Error while running the code , attached is the Error and Code , that's not working. Thank's in Advance

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/configouting.yml"). Make sure annotations are installed and enabled.)

Code:

//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>'
         );
     }
}
  • 写回答

1条回答 默认 最新

  • dsa2c2255888 2018-07-05 11:37
    关注

    Actually i have used

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

    While the Accurate Format is

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

    Solved

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?