我可以在類之外更改在類中定義的函數或變量,但不使用全局變量嗎?PHP - 從類之外更改類變量/函數
這是類,裏面包含文件#2:
class moo{
function whatever(){
$somestuff = "....";
return $somestuff; // <- is it possible to change this from "include file #1"
}
}
在主應用程序
,這是怎樣的類用於:
include "file1.php";
include "file2.php"; // <- this is where the class above is defined
$what = $moo::whatever()
...
你是什麼意思的「包含文件#1」? – Gordon 2011-02-10 09:27:28