繁体   English   中英

如此简单的php代码正在打印出奇怪的东西。im无法弄清楚为什么会这样?

[英]such a simple code of php is printing weird things out.i m not able to figure out why is this happening?

PHP代码来打印简单的字符串!

<!DOCTYPE html>
  <html>
<body>

<?php
$color="red";  //just a simple variable//
echo "My car is " . $color . "<br>";
echo "My house is " . $color . "<br>";
  echo "My boat is " . $color. "<br>";
 ?>

</body>
</html><!end of html>

上面的代码给出了错误的输出,可能是什么原因? 输出:

“; echo”我的房子是“。$ color。”“; echo”我的船是“。$ color。”“;?>

<!DOCTYPE html>
  <html>
<body>

<?php
$color="red";  //just a simple variable//
echo "My car is " . $color . "<br>";
echo "My house is " . $color . "<br>";
  echo "My boat is " . $color. "<br>";
 ?>

</body>
</html><!end of html>

另存为

demo.php in htdocs

执行http://localhost/demo.php

暂无
暂无

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

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