我需要將一個變量從靜態函數傳遞給另一個類中的另一個變量。 我不寫完整的代碼,我需要的理論過程公共靜態函數php傳遞變量
enter code here
class One
{
public static function One()
{
/**
* some code extract from DB $one
*/
}
public static function two()
{
/**
* I need to retrieve the variable $one to use it in another query DB
*/
}
}
注:
你不能在靜態函數中使用$此
您可以定義$一個作爲類的靜態變量,那麼你就可以訪問它在函數的兩個 –