【发布时间】:2020-01-20 03:28:03
【问题描述】:
我创建了一个控制器 pageController.php :
<?php
namespace App\Controller;
use Symfony\Component\HttpFoundation\Response;
class pageController {
public function index()
{
return new Response('<html><body>hello...</body></html>');
}
public function contactAction()
{
return new Response('<html><body>contact...</body></html>');
}
}
这里是 routes.yml
index:
path: /
controller: App\Controller\pageController::index
contact:
path: /contact
controller: App\Controller\pageController::contactAction
索引工作正常,但联系人不起作用!
注意:当我把index的路径从“/”改成“/index”时,就不行了,显示404 not found
在我想解决这个问题之前,我不想使用注释
【问题讨论】: