我有一个函数:PHP的file_get_contents与变量
myfunc() {
$a = "John";
$str = "Hello $a, how are you today?"
return $str;
}
echo myfunc(); //Hello John, how are you today?
我想所有的sentenses保存在功能到另一个文件,因为它们的长度太长,把它放在我的功能。
myfunc() {
$a = "John";
$str = file_get_contents("inc_file.html");
return $str;
}
inc_file.html:
Hello $a, how are you today?
但它并没有返回如我所料。变量$ a不会更改为John。 请帮帮我! 谢谢
不,我不希望保存文件,某些功能。我手动创建html文件。仅用于阅读和显示HTML文件内容的PHP代码 –