我正在尝试在symfony中创建一个新页面,但我无法访问它
这是我的档案
<?php
namespace AppBundle\Controller;
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
use Symfony\Component\HttpFoundation\Request;
class About extends Controller
{
/**
* @Route("/about")
*/
public function aboutAction()
{
return new Response(
'<html><body>This page is about ME</body></html>'
);
}
}
当我使用php bin/console debug:router
它显示名称:app_about_about(我不明白为什么它有这个名字)和路径:/ about。但是当我尝试加载页面时,我收到404错误
答案 0 :(得分:0)
导入后尝试:
use Symfony\Component\HttpFoundation\Response;
答案 1 :(得分:0)
只需将您的文件重命名为./MyBundle/Controller/AboutController.php并重命名该类:
SELECT
runtable.operation,
pareto.failure,
COUNT(CASE WHEN MONTH(runtable.time) = 1 THEN 1 else NULL end) as 'Jan',
COUNT(CASE WHEN MONTH(runtable.time) = 2 THEN 1 else NULL end) as 'Feb',
COUNT(CASE WHEN MONTH(runtable.time) = 3 THEN 1 else NULL end) as 'Mar',
COUNT(CASE WHEN MONTH(runtable.time) = 4 THEN 1 else NULL end) as 'Apr',
COUNT(CASE WHEN MONTH(runtable.time) = 5 THEN 1 else NULL end) as 'May',
COUNT(CASE WHEN MONTH(runtable.time) = 6 THEN 1 else NULL end) as 'Jun',
COUNT(CASE WHEN MONTH(runtable.time) = 7 THEN 1 else NULL end) as 'Jul',
COUNT(CASE WHEN MONTH(runtable.time) = 8 THEN 1 else NULL end) as 'Aug',
COUNT(CASE WHEN MONTH(runtable.time) = 9 THEN 1 else NULL end) as 'Sep',
COUNT(CASE WHEN MONTH(runtable.time) = 10 THEN 1 else NULL end) as 'Oct',
COUNT(CASE WHEN MONTH(runtable.time) = 11 THEN 1 else NULL end) as 'Nov',
COUNT(CASE WHEN MONTH(runtable.time) = 12 THEN 1 else NULL end) as 'Dec',
COUNT(pareto.failure) as 'Total year'
FROM
runtable
JOIN pareto
ON pareto.run_id = runtable.id
WHERE
runtable.time BETWEEN '2016-01-01 00:00:00' AND '2016-12-13 23:59:59'
AND runtable.operation IN ('d','hr')
GROUP BY
runtable.operation, pareto.failure
;
答案 2 :(得分:0)
我认为你应该试试路线名称。您还应该按AboutController
重命名控制器。
/**
* @Route("/about", name="about_page")
*/