简体   繁体   English

在Textarea中显示PHP

[英]Display PHP in Textarea

I'm trying to display a php variable in a text area but it just outputs what is in between the text area tags 我正在尝试在文本区域中显示一个php变量,但它只是输出文本区域标签之间的内容

Here's my code: 这是我的代码:

echo  "Allergens Contained "    .'<textarea rows="4"     name="Allergens_Contains">   <?php echo $contains; ?></textarea>';

In the text area on my webpage all I'm getting is: <?php echo $contains; ?> 在我网页的文本区域中,我得到的只是: <?php echo $contains; ?> <?php echo $contains; ?>

You should concatenate strings and variables via: 您应该通过以下方式连接字符串和变量:

<?php
echo 'This is text ' . $php_variable . ' more text';

or 要么

<?php
echo "This is text " . $php_variable . " more text";

or 要么

<?php
echo "This is text $php_variable more text";

or 要么

<?php
echo "This is text {$php_variable} more text";

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM