我的代码看起来像这样(完整代码有47行):
$this->outline->value = $row['value'];
$this->outline->some_value = $row['some_value'];
$this->outline->specs = $row['specs'];
$this->outline->second_marker = $row['second_marker'];
$this->outline->holes = $row['holes'];
如何在保持相同功能的同时缩小尺寸?
答案 0 :(得分:6)
foreach ($row as $key => $value) {
$this->outline->{$key} = $value;
}