PHP函数echo <h1>,<h2>中的文本

Gab*_*líř -1 php

这只是一个例子,但我可以解决这个问题吗?

function echoText($text){
    echo $text;
}

$text2 = echoText("Text");
echo "<h1>$text2</h1><br><h2>$text</h2><h3>$text</h3>";
Run Code Online (Sandbox Code Playgroud)

但结果不是<h1>,<h2>或者<h3>,它只是简单的文本.

blo*_*ead 6

你的函数没有返回值,而是回显它.

尝试

function echoText($text){
    return $text;
}
Run Code Online (Sandbox Code Playgroud)