PHP 循环抛出通知,貌似一直报错
PHP loop throwing notice, which seems to be a constant error
$features[] = array("Feature 1", "Feature 2", "Feature 3", "Feature 4")
for ($i=0; $i <4 ; $i++) {
echo '<li class="list-group-item text-centre">'. $features[i] . '</li>';
我无法解决通知:
Notice: Use of undefined constant i - assumed 'i' in /home3/..../public_html/html......com/all/stripe/index.php on line 48
它是 $features[]
的原因。
使用:
$features = array("Feature 1", "Feature 2", "Feature 3", "Feature 4")
$features[]
表示您将 =
之后的值传递到 $features
数组的新索引中,即 $features[0][your_array]
和
echo '<li class="list-group-item text-centre">'
。 $特征[$i] 。 '</li>'
;
替换为
echo '<li class="list-group-item text-centre">'. $features[$i] . '</li>';
$features[] = array("Feature 1", "Feature 2", "Feature 3", "Feature 4")
for ($i=0; $i <4 ; $i++) {
echo '<li class="list-group-item text-centre">'. $features[i] . '</li>';
我无法解决通知:
Notice: Use of undefined constant i - assumed 'i' in /home3/..../public_html/html......com/all/stripe/index.php on line 48
它是 $features[]
的原因。
使用:
$features = array("Feature 1", "Feature 2", "Feature 3", "Feature 4")
$features[]
表示您将 =
之后的值传递到 $features
数组的新索引中,即 $features[0][your_array]
和
echo '<li class="list-group-item text-centre">'
。 $特征[$i] 。 '</li>'
;
替换为
echo '<li class="list-group-item text-centre">'. $features[$i] . '</li>';