我正在尝试从数据库中检索带有cakePHP的选择框但是数据未被正确检索

I am using cakephp 3.3 I have in the controller

    $employee = TableRegistry::get('employees');
    $allNames = $employee->find('list', array('employee_name' => array('employee_name') ) );
    $allNames = $allNames->toArray();
    $this->set('name', $allNames);

and in my template

    <?= $this->Form->input('employee', array('type'=>'select','label' => false,
        'options' => $name,'value'=>$name));?>

The only thing being retrieved and displayed is the number of entries i have in the database, $name only contains an array(1,2,3,4) when it should be actual people names.

Did you read the documentation about how find('list') works?'

$allNames = $employee->find('list', [
    'keyField' =>     'employee_name'
    'valueField' => 'employee_name'
]);
$this->set('name', $allNames);

<?= $this->Form->input('employee', ['type'=>'select','label' => false,
    'options' => $name]);?>

You can map id and value by keyField and valueField in list query

in your controller

 $employee = TableRegistry::get('employees');
 $allNames = $employee->find('list', array('valueField' =>employee_name','keyField'=>'employee_id' )); // correct employee_id with your table id field.
 $this->set('name', $allNames);

In your View

 <?= $this->Form->input('employee', array('type'=>'select','label' => false,
        'options' => $name));?>