我有一個函數: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代碼 –