所以我必須:簡單的PHP類問題
class foo {
public $variable_one;
public $variable_two;
function_A(){
// Do something
$variable_one;
$variable_two;
// If I define variable_3 here!
$variable_3
// Would I be able to access it in function_B?
}
function_B(){
// Do something
$variable_4 = $variable_3
}
}
$myObj = new foo();
// Now what do I write in order to assign "variable_one" and "two" some value?
$myObj->$variable_one = 'some_value' ??
$myObj->$variable_two = 'some_value' ??
訪問公共屬性的語法是'$ myObj-> variable_one',而'$ myObj-> $ variable_one'是'$ myObj-> foo' if if $ variable_one =='foo''。 – p4bl0 2009-08-19 23:51:11
$ myObj-> variable_one ='將值賦給某物'; – localshred 2009-08-19 23:56:50