如何将 php 变量回显到 html textarea

How to echo a php variable into html textarea

我有以下问题。我想在 html 文本区域中回显一个 php 变量。但我无法让它为我解决。这是我的代码。

<?php

$y = 123

?>

<textarea name="delay" cols="50"rows="5" id="delay">
<?php echo $y ?>
</textarea>

这是我看到的

一个简单的方法是:

<?php

$y = 123;

echo "<textarea title='textarea' name='delay' cols='50' rows='5' id='delay'>".$y."</textarea>";

?>

也在cols="50"rows="5"之间应该是一个空格。喜欢:cols="50" rows="5"