我有一个数组。print_r 这个数组的结果是这样的:
Array
(
[flat_rate] => WC_Shipping_Rate Object
(
[id] => flat_rate
[label] => book
[cost] => 8000
[taxes] => Array
(
)
[method_id] => flat_rate
)
[local_delivery] => WC_Shipping_Rate Object
(
[id] => local_delivery
[label] => dvd
[cost] => 15000
[taxes] => Array
(
)
[method_id] => local_delivery
)
)
我需要像这样创建数组。我尝试通过以下代码访问此数组:
Array("flat_rate" => (object) Array("id" => "flat_rate" ,"label" => "book" ,"cost" => 8000 ,"taxes" => Array ( ) ,"method_id" => "flat_rate") ,"local_delivery" => (object) Array("id" => "local_delivery" ,"label" => "book" ,"cost" => 15000 ,"taxes" => Array ( ) ,"method_id" => "local_delivery"));
但是当 print_r 这个数组时,WC_Shipping_Rate由stdClass改变