如何在php echo中获取$ test值?
第7行:
<?php function writeMsg() {
echo "</form>";
echo "<form name='input' action='index.php' method='get'>";
echo "<table border='0' cellpadding='0' cellspacing='0' width='600' height='400'>";
echo "<tr>";
echo "<td height='560'><textarea class='textarea' name='xml' cols='83' rows='37'>";
echo "$test";
echo "</textarea></td>";
echo "</tr>";
echo "<tr>";
echo "<td height='40' align='center'><input type='submit' value='PRENESI XML'></td>";
echo "</tr>";
echo "</table>";
echo "</form>";
}
?>
任何解决方案都会很棒。谢谢
答案 0 :(得分:2)
从字面上看OP的例子,需要定义$test
以便echo
输出任何东西。此外,除非调用它,否则该函数不会执行任何操作。
function writeMsg() {
$test = "foo";
echo "$test";
}
writeMsg();
输出:
foo