PHP 输出错误


Php output error

我的代码有什么问题?

$text="hello world";
echo "the string above contains .$text";?>

执行代码时收到错误消息,谢谢!

可能是

你忘了写 php 起始标签

<?php
 $text="hello world";
 echo "the string above contains .$text";
?>

$text = "hello world";
echo "text is " . $text;

第 2 行出现语法错误,试试这种方式

<?php
$text="hello world";
echo "the string above contains $text";?>

您似乎省略了第一行:

<?php 
$text="hello world";
echo "the string above contains ".$text;
?>