最近开始修复旧项目的一些代码,但是我生气了并且不能为我的生活看到这个代码的错误...据我所知它看起来很好但是在3.25我什么都不对!
错误:
PHP Parse error: syntax error, unexpected 'value' (T_STRING), expecting ',' or ';'
守则:
<?php
if ($post_rank == 0) {
echo '<option value="0" selected="selected">0</option>';
} else if ($post_rank == 1) {
echo '<option value="1" selected="selected">1</option>';
} else if ($post_rank == 2) {
echo '<option value="1" selected="selected" >2</option>';
} else if ($post_rank == 3) {
echo '<option value="1" selected="selected">3</option>';
} else if ($post_rank == 4) {
echo '<option value="1" selected="selected">4</option>';
} else if ($post_rank == 5) {
echo '<option value="1" selected="selected">5</option>';
} else if ($post_rank == 6) {
echo '<option value="1" selected="selected">6</option>';
} else if ($post_rank == 7) {
echo '<option value="1" selected="selected">7</option>';
} else if ($post_rank == 8) {
echo '<option value="1" selected="selected">8</option>';
} else if ($post_rank == 9) {
echo '<option value="1" selected="selected">9</option>';
} else if ($post_rank == 10) {
echo '<option value="1" selected="selected">10</option>';
} else if ($post_rank == 11) {
echo '<option value="1" selected="selected">11</option>';
} else if ($post_rank == 12) {
echo '<option value="1" selected="selected">12</option>';
} else if ($post_rank == 13) {
echo '<option value="1" selected="selected">13</option>';
} else if ($post_rank == 14) {
echo '<option value="1" selected="selected">14</option>';
} else if ($post_rank == 15) {
echo '<option value="1" selected="selected">15</option>';
}
?>
答案 0 :(得分:0)
这是问题,
echo '<option value='0' selected="selected">0</option>';
应该是
echo '<option value="0" selected="selected">0</option>';
^ double quotes.