我有一个保存在postmata中的数组,每个数组键都成为一个元键。我想更改代码以使用一个metakey保存整个数组。怎么做?谢谢!
$poddata = Array(
'pod_id' => $this->pod_id,
'url' => $this->url,
'name' => $this->name,
'description' => $this->description,
'service' => $this->service,
'status' =>$this->status,
'price' => $this->price
);
foreach ( $poddata as $k => $v ){
if ( get_post_meta( $this->id, $k ) == '' )
add_post_meta( $this->id, $meta_box, $v, true );
elseif ( $v != get_post_meta( $this->id, $k, true ) )
update_post_meta( $this->id, $k, $v );
elseif ( $v == '' )
delete_post_meta( $this->id, $k, get_post_meta( $this->id, $k, true ) );
}