如何在PHP代码的“和”之间插入html。
我想在h hello
处插入html代码 - 但它不会让我。
$this->setError($postName, ucfirst($postName)." hello.");
} else if(strlen($postVal) > intval($max)) {
我想将此代码插入hello。
<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Thank You!</strong> We hope to get back to you shortly.
</div>
答案 0 :(得分:1)
$str = '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Thank You!</strong> We hope to get back to you shortly.
</div>';
$this->setError($postName, ucfirst($postName).$str);
} else if(strlen($postVal) > intval($max)) {
答案 1 :(得分:0)
您只需将HTML代码添加到变量中,然后只需将其连接到您想要的位置即可。
这就是:
$html = '<div class="alert alert-success">
<button type="button" class="close" data-dismiss="alert">×</button>
<strong>Thank You!</strong> We hope to get back to you shortly.
</div>';
$this->setError($postName, ucfirst($postName).$html);
} else if(strlen($postVal) > intval($max)) {
希望这会有所帮助。 :) (对不起,如果这属于评论,实际上无法在问题中发表评论。)