2017-04-24 18 views
0

これは私のホームページです。他のページにリダイレクトするタグは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" 
      ); 
    } 

} 

}

私はあなたが考えているか知っています。 h1タグに "/"を入れる。すでに試してみましたが、うまくいきません。私が気づいたのは、@Route('/dashboard')@Route('/(dashboard)')に変更すると、ダッシュボードページが読み込まれるということです。

答えて

関連する問題