我正在尝试将<div>
添加到我的php中,但我在谷歌上找到的所有内容都不适用于我。我不知道我做错了什么。关于如何在PHP函数中添加<div>
仅用于样式目的的任何想法?
<?php
//get_additional is a custom function
ob_start();
echo get_additional('Cosmos','Trades');
echo nl2br("\n");
//I want the div to start here
$buffered = ob_get_clean();
echo $buffered;
$times = $buffered;
$imgurl = 'Images/cat.png';
for($i=0;$i<$times;$i++){
echo '<img src="'.$imgurl.'" />';
}
?>
答案 0 :(得分:1)
您需要echo '<img src="'.$imgurl.'" />';
。
就像您在代码中使用过一次<?php
//get_additional is a custom function
ob_start();
echo get_additional('Cosmos','Trades');
echo nl2br("\n");
//I want the div to start here
echo '<div class = "blah">
// whatever you want to do here
</div>';
$buffered = ob_get_clean();
echo $buffered;
$imgurl = 'Images/cat.png';
for($i=0;$i<$times;$i++){
echo '<img src="'.$imgurl.'" />';
}
?>
现在回到你的代码:
R = A * x + exp(x) - b