这是我的主页。没什么,只有3个标签重定向到不同的页面。 代码:
<div>
<h1> Welcome to my YeePHP project</h1>
<h1> Click <a href=" register "> here </a> to register</h1>
<h1> Click <a href=" login "> here </a> to login</h1>
<h1> Click <a href=" dashboard "> here </a> to enter the dashboard</h1>
这是我的DashboardController:
class DashboardController extends \Yee\Managers\Controller\Controller
{
/**
* @Route('/dashboard')
* @Name('dashboard.index')
*/
public function index()
{
$app = $this->getYee();
$app->render('dashboard/dashboard.twig', $data = array(
));
}
/**
* @Route('/dashboard')
* @Name('dashboard.post')
* @Method('POST')
*/
public function post()
{
$app = $this->getYee();
$name = $app->request->post('name');
$comment = $app->request->post('comment');
$AddCommentModel = new AddCommentModel($name, $comment);
if($AddCommentModel->comment() == true)
{
$AddCommentModel->insertCommentsInDb();
$app->render('dashboard/dashboard.twig', $data = array());
}
else
{
$data = array(
"error"
);
}
}
}
我知道你在想什么。放一个&#34; /&#34;在h1标签中。已经尝试过但遗憾的是它没有用。我注意到的是,如果我将@Route('/dashboard')
更改为@Route('/(dashboard)')
,则会加载我的信息中心页面。