我寫的,我認爲不可能是更基本的功能:函數返回NULL值,而不是
在functions.php中:
function testowa() {
$stringToReturn = "pies";
return $stringToReturn;
}
然後我試圖調用它的single.php :
include_once ('functions.php');
testowa();
var_dump($stringToReturn);
and var_dump
顯示NULL。
我哪裏可能做錯什麼?
Undefi ned變量。閱讀變量作用域:http://php.net/manual/en/language.variables.scope.php – Daan
| ... | => http://php.net/manual/en/function.error-reporting .php –
include_once('functions.php'); $ stringToReturn = testowa(); var_dump($ stringToReturn); –