-1
ZF2.In에서 뷰 파일을 만듭니다.이 파일은 컨트롤러에 ID를 전달합니다.zf2에서 테이블 ID를 얻는 방법은 무엇입니까?
컨트롤러에서이 ID를 어떻게 얻을 수 있습니까? 여기
내가 ID를 얻으려면 내 showAction 코드 :public function showAction()
{
$id = (int) $this->params()->fromRoute('id', 0);
if (!$id) {
return $this->redirect()->toRoute('calendar', array(
'action' => 'create'
));
}
}
을 여기에 내가 컨트롤러 보여 ID를 전달하는 내 index.phtml입니다 : 당신은 gettting하는
<table class="table">
<tr>
<th>Calendar name</th>
<th>Description</th>
<th>Actions</th>
</tr>
<?php foreach ($calendars as $key => $value) : ?>
<tr>
<td>
<a href="<?php echo $this->url('calendar',array('action'=>'show', 'id' => $this->escapeHtml($value['_id'])));?>">
<?php echo $this->escapeHtml($value['title']);?>
</a>
</td>
<td><?php echo $this->escapeHtml($value['description']);?></td>
<td>
<a href="<?php echo $this->url('calendar',
array('action'=>'settings', 'id' => $this->escapeHtml($value['_id'])));?>">Settings</a>
<a href="<?php echo $this->url('calendar',
array('action'=>'delete', 'id' => $this->escapeHtml($value['_id'])));?>">delete</a>
</td>
</tr>
<?php endforeach; ?>
</table>
또 다시 새 스레드를 생성하기 중지하십시오 받아야합니다. 이것은 지금 2 일 동안 동일한 문제이며 아무것도 바꾸지 않습니다. 당신은 문제가 어디에 있는지조차 알지 못합니다. 당신은 필요한 모든 도움을 얻었습니다. 이 질문에는 지금 질문이 없습니다. '$ id' 변수에 ID를 이미 가지고있는 한 당신의 경로가 그것을 허용합니다. 다시 한번 : 처음부터 문서를 시작하십시오. – Sam
가능한 [mongo odm을 사용하여 zf2에서 fullcalendar 이벤트를 표시하는 방법?] (http://stackoverflow.com/questions/23136588/how-to-show-fullcalendar-events-in-zf2-using-mongo-odm) – Sam
샘 지난 2 주간 실제로 얼굴을 보았던 내 문제를 풀어 보았지만 컨트롤러에서 ID에 액세스하면 코드에 액세스하지 않습니다. –