我不能让它发挥作用。带有jqm data-native-menu =“false”的php数组不显示所有项目,只显示第一个和最后一个项目。如果data-native-menu =“true”,则显示所有项目。我该如何解决?
<?php
$fooArray = array('Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday');
?>
<!DOCTYPE html>
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.css" />
<script src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script src="js/jquery.js"></script>
<script src="http://code.jquery.com/mobile/1.0.1/jquery.mobile-1.0.1.min.js"></script>
</head>
<body>
<section id="main" data-role="page">
<header data-role="header" data-theme="b"><h1></h1></header>
<div data-role="content">
<div data-role="fieldcontain">
<label for="select-choice-1" class="select">Choose the day:</label>
<select name="select-choice-1" id="select-choice-1" data-native-menu="false">
<?php foreach ($fooArray as $value) { echo '<option value=>'.$value.'</option>'; } ?>
</select>
</div>
</div>
<footer data-role="footer" data-theme="b"><h1></h1></footer>
</section>
</body>
答案 0 :(得分:1)
将您的foreach循环更改为此
<?php foreach ($fooArray as $value) { echo '<option value="'.$value.'">'.$value.'</option>'; } ?>