私はcakephpの初心者です。私はexisting_question.ctpという名前のチェックボックスフォームを作成し、配列に格納しました。しかし、私はprint_rしようとすると、配列は本当に奇妙な出てくる。 thisのようになります。CakePHP 3.5チェックボックス配列
existing_question.ctp
<?php
/**
* @var \App\View\AppView $this
* @var \App\Model\Entity\Question[]|\Cake\Collection\CollectionInterface
$questions
*/
use Cake\ORM\TableRegistry;
?>
<nav class="large-3 medium-4 columns" id="actions-sidebar">
<ul class="side-nav">
<li class="heading"><?= __('Actions') ?></li>
<li><?= $this->Html->link(__('Courses'), ['controller' => 'Courses',
'action' => 'index']) ?></li>
</ul>
</nav>
</nav>
<div class="questions form large-9 medium-8 columns content">
<fieldset>
<legend><?= __('Add Question') ?></legend>
<table cellpadding="0" cellspacing="0">
<thead>
<tr>
<th scope="col"><?= $this->Paginator->sort('checked') ?></th>
<th scope="col"><?= $this->Paginator->sort('id') ?></th>
<th scope="col"><?= $this->Paginator->sort('question') ?></th>
<th scope="col"><?= $this->Paginator->sort('marks') ?></th>
</tr>
</thead>
<tbody>
<?php echo $this->Form->create($question) ?>
<?php foreach ($questions as $question): ?>
<tr>
<td><?= $this->Form->checkbox('id[].', array('value' =>
$question['id'], 'name' => 'Question[id][]', 'checked'=>false))?></td>
<td><?= $this->Number->format($question->id) ?></td>
<td><?= h($question->question) ?></td>
<td><?= $this->Number->format($question->marks) ?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
<input type="submit" value="Save">
</form>
<div class="paginator">
<ul class="pagination">
<?= $this->Paginator->first('<< ' . __('first')) ?>
<?= $this->Paginator->prev('< ' . __('previous')) ?>
<?= $this->Paginator->numbers() ?>
<?= $this->Paginator->next(__('next') . ' >') ?>
<?= $this->Paginator->last(__('last') . ' >>') ?>
</ul>
<p><?= $this->Paginator->counter(['format' => __('Page {{page}} of {{pages}}, showing {{current}} record(s) out of {{count}} total')]) ?></p>
<?php //$this->Form->button(__('Submit'), ['action' => 'existingQuestion'])
$this->Form->submit('Save');
// $this->Form->end() ?>
</div>
</fieldset>
私は非常に多くのチュートリアルを試みたが、それが必要のようにそれはdoesntのが出てきます。誰も私を助けることができます???
EDITED: 私はそれがすべてのthis
のようになります。期待される結果とは何ですか? – shahonseven
投稿を編集しました –