【发布时间】:2017-09-15 20:56:10
【问题描述】:
我正在关注 symfony 上的 openclassrooms 教程。我现在在“Les controleurs avec Symfony”一章。
我尝试打开 http://localhost/Symfony/web/app_dev.php 并收到此错误
我怀疑错误来自 AdvertController.php。 但是我将它与教程中给定的代码进行了比较。它是完全一样的。然后我尝试删除缓存,但它不起作用。我将为此提出另一个问题。
这里是 AdvertController.php 代码:
<?php
//src/Neo/PlatformBundle/Controller/AdvertController.php
namespace Neo\PlatformBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Response;
//use Symfony\Component\Routing\Generator\UrlGeneratorInterface;
class AdvertController extends Controller
{
public function indexAction()
{
$url= $this->get('router')->generate(
'neo_platform_view', //first argument : path name
array('id' => 5)
);
return new Response("The url of the announcement is:".$url);
}
public function viewAction($id)
{
return new Response("Desplay of the announcment with id:".$id);
}
public function viewSlugAction($slug, $year, $_format)
{
return new Response(
"We could desplay the announcment conrresponding the the slug
'".$slug."', created in ".$year." and with the format ".$_format."."
);
}
}
?>
如果您希望我发布其他代码部分,请告诉我。 我不知道在哪里看。
非常感谢!
【问题讨论】:
标签: symfony