2016-08-17 73 views
-1

我该如何解决这个脚本? 我正在寻找的结果是iframe的php循环错误

The number is: 1 and <iframe src="demo_iframe.htm" height="200" width="300"></iframe> 
The number is: 2 and <iframe src="demo_iframe.htm" height="200" width="300"></iframe> 
The number is: 3 and <iframe src="demo_iframe.htm" height="200" width="300"></iframe> 

,我使用这个脚本

<?php 
for ($x = 0; $x <= 10; $x++) { 
    echo "The number is: $x and <iframe src="demo_iframe.htm" height="200" width="300"></iframe> <br>"; 
} 
?> 

</body> 
</html> 

但结果却是一个错误。

+1

看看你的报价 – 2016-08-17 05:01:28

+0

欢迎的StackOverflow!当问这样的问题总是*包括你得到的错误*。诊断更复杂的问题可能至关重要。在这种情况下,虽然..雅,修正你的报价。并考虑使用'printf()'而不是'echo'。 – ghoti

回答

2
<?php 
    for ($x = 0; $x <= 10; $x++) { 
     echo 'The number is: '.$x.' and <iframe src="demo_iframe.htm" height="200" width="300"></iframe> <br>'; 
    } 
    ?> 
+0

thx为答案:D –

2
for ($x = 0; $x <=10; $x++) { 

echo "The number is:".$x.' and <iframe src="demo_iframe.htm" height="200" width="300"></iframe> <br>'; 
} 
+0

thx为答案:D –

+0

欢迎Fian Julio :) – user1234