我正在使用代码点火器,我正在尝试发送多个数组来查看
这是控制器中的多个数组我将此数组传递给视图
$data=Array (
[email] => Array (
[abv] => Array (
[name] => Abv
[version] => 1.0.7
[description] => Get the contacts from a Abv account
[base_version] => 1.8.4
[type] => email
[check_url] => http://m.abv.bg
[requirement] => email
[allowed_domains] => Array (
[0] => /(abv.bg)/i
[1] => /(gyuvetch.bg)/i
[2] => /(gbg.bg)/i
)
[imported_details] => Array (
[0] => first_name
[1] => email_1
)
)
)
)
$this->load->view('view', $data)
这是观点,
<?php
foreach($data as $type=>$providers) {
if ($type == 'email')
"<optgroup label='email group'>"
else
"<optgroup label='social group'>";
foreach ($providers as $provider=>$details)
"<option value='{$provider}'".($_POST['provider_box']==$provider?' selected':'').">{$details['name']}</option>";
"</optgroup>";
}
?>
它打印出任何东西。 你能解释为什么它有效吗?
答案 0 :(得分:1)
你错过了回声,这可能解释为什么没有打印出来。例如:
echo "<optgroup label='email group'>";