如何在PHP对象中添加键值? (笨)

时间:2013-08-27 05:00:42

标签: php codeigniter

实施例,

$params = array($demandnum,$demandnum,$demandnum,$demandnum,$demandnum,$demandnum,$demandnum,$demandnum,$demandnum,$demandnum,$demandnum,$demandnum );
$stmt = $this->db_gcm->query($query, $params);
$test = $stmt->row();

print_r($test);

结果,

stdClass Object( [server_price] => 32398.63 [server_unit] => 2 [network_price] => 0.00 
[network_unit] => 3 [storage_price] => 4948.02 [storage_unit] => 2 
[loadbalancer_price] => 2200.00 [loadbalancer_unit] => 1 
[additionalservice_price] => 105375.60 [additionalservice_unit] => 4 [support_price] => [support_unit] => 0)

我想在这里添加键值。

有什么好主意吗?

1 个答案:

答案 0 :(得分:13)

  

我想在这里添加键值。

在哪里? $test?怎么样

$test->key = 'value';