static function RowToObject($dbRow){
$st=new SensorTemplate();
$st->TemplateID=$dbRow["TemplateID"];
$st->ManufacturerID=$dbRow["ManufacturerID"];
$st->Model=$dbRow["Model"];
$st->TemperatureOID=$dbRow["TemperatureOID"];
$st->HumidityOID=$dbRow["HumidityOID"];
$st->TempMultiplier=$dbRow["TempMultiplier"];
$st->HumidityMultiplier=$dbRow["HumidityMultiplier"];
$st->mUnits=$dbRow["mUnits"];
return $st;
}
//该方法将数据存储到一个实例对象中,而不是存储到$this类本身
foreach(SensorTemplate::RowToObject($sensorRow) as $prop => $value){
$this->$prop=$value; //$prop=temp
}
$this->$prop=$value; //$this->temp=$value;
$this->$prop 指的是对应的变量名称对应值