我们可以应用 php 构造,以及 php 字符串变量中的逻辑......就像
// php string variable:
$content = "Something in string........bla bla bala.......".
while(.....){}
."agian string...";
echo $content;
// i am getting error => unexpected T_WHILE in my php....
不,你不能。但你可以使用一个函数:
function myFunction() {
while(....) {
...
}
return $something;
}
$content = "Something in string........bla bla bala......." . myFunction() . "agian string...";
echo $content;
不。不,你不能。
正确使用字符串连接:
$content = "Start";
while (<something>) {
$content .= "Middle";
}
$content .= "End";
不,你不能那样做,但你可以这样做。
$content = "Something in string........bla bla bala.......";
while(.....){
$content .= "agian string...";
}
echo $content;
不。您必须循环附加:
$content = "Something in string........bla bla bala.......";
while ($i++ < 20) {
$content .= 'something else';
}
$content .= 'something to end';
echo $content;