这是代码
for($r=1; $r<=10; $r++){
if($shirt_info[$r][0]!='Select One')
{
echo '<div class='shirtinfo'>Order $r: </div>';
echo '<div class='shirtinfo'>Size: '.$shirt_info[$r][0].'</div>';
echo '<div class='shirtinfo'>Price: '.$shirt_info[$r][1].'</div>';
echo '<div class='shirtinfo'>Qty: '.$shirt_info[$r][2].'</div>';
echo '<div class='shirtinfo'>SPE: '.$shirt_info[$r][5].'</div>';
echo '<div class='shirtinfo'>LIA: '.$shirt_info[$r][6].'</div>';
echo '<div class='shirtinfo'>Vendor: '.$shirt_info[$r][7].'</div>';
echo '<div class='shirtinfo'>Style: '.$shirt_info[$r][8].'</div>';
echo '<div class='shirtinfo'>Color: '.$shirt_info[$r][9].'</div>';
echo '<div style='clear:both;'></div>';
}}
答案 0 :(得分:1)
来自php手册:
有关字符串行为方式的信息,尤其是有关字符串的用法 单引号,双引号和转义序列,请参阅字符串 在手册的类型部分输入。
http://www.php.net/manual/en/language.types.string.php
// Outputs: Arnold once said: "I'll be back"
echo 'Arnold once said: "I\'ll be back"';
答案 1 :(得分:0)
转义你的引号或使用双引号:
逃逸:
echo '<div class=\'shirtinfo\'>Order $r: </div>';
echo '<div class=\'shirtinfo\'>Size: '.$shirt_info[$r][0].'</div>';
echo '<div class=\'shirtinfo\'>Price: '.$shirt_info[$r][1].'</div>';
echo '<div class=\'shirtinfo\'>Qty: '.$shirt_info[$r][2].'</div>';
echo '<div class=\'shirtinfo\'>SPE: '.$shirt_info[$r][5].'</div>';
echo '<div class=\'shirtinfo\'>LIA: '.$shirt_info[$r][6].'</div>';
echo '<div class=\'shirtinfo\'>Vendor: '.$shirt_info[$r][7].'</div>';
echo '<div class=\'shirtinfo\'>Style: '.$shirt_info[$r][8].'</div>';
echo '<div class=\'shirtinfo\'>Color: '.$shirt_info[$r][9].'</div>';
echo '<div style=\'clear:both;\'></div>';
使用双引号:
echo '<div class="shirtinfo">Order $r: </div>';
echo '<div class="shirtinfo">Size: '.$shirt_info[$r][0].'</div>';
echo '<div class="shirtinfo">Price: '.$shirt_info[$r][1].'</div>';
echo '<div class="shirtinfo">Qty: '.$shirt_info[$r][2].'</div>';
echo '<div class="shirtinfo">SPE: '.$shirt_info[$r][5].'</div>';
echo '<div class="shirtinfo">LIA: '.$shirt_info[$r][6].'</div>';
echo '<div class="shirtinfo">Vendor: '.$shirt_info[$r][7].'</div>';
echo '<div class="shirtinfo">Style: '.$shirt_info[$r][8].'</div>';
echo '<div class="shirtinfo">Color: '.$shirt_info[$r][9].'</div>';
echo '<div style="clear:both;"></div>';
此外,我认为您的意思是echo '<div class="shirtinfo">Order '.$r.': </div>';
而不是echo '<div class="shirtinfo">Order $r: </div>';