如何打印括号中的变量?像ip board,例如我有这样的代码:
<?php
$variable = "test";
?>
<div class="test">{$variable}</div>
我该怎么做?不是
echo $变量;?>
but {$variable} !3
这叫做串联,它使用'。"把事情串在一起……"
<div class="test"><?php echo '{'.$variable.'}' ?></div>
你可以这样使用
<?= $variable ?>
使用php模板引擎。最适合你的是使用Laravel和Balde
是的,你可以这样做
<?php
$variable = "test";
?>
<div class="test"><?= $variable; ?></div>
但是如果你想使用上面的方法(你的方法),你必须使用blade templating engine
看一看