如何从PHP中的数组对象获取值

时间:2019-06-15 07:01:31

标签: php

我需要数组中的地堡的值

resolver = tf.contrib.cluster_resolver.TPUClusterResolver('grpc://' + os.environ['COLAB_TPU_ADDR'])
tf.contrib.distribute.initialize_tpu_system(resolver)
strategy = tf.contrib.distribute.TPUStrategy(resolver)
with strategy.scope():
 model=myKerasmodel()
 model.compile()....


3 个答案:

答案 0 :(得分:0)

$object= new stdClass; 
$object->id = 1; 
$object->images = null; 
$object->place = "palampur"; 


$array = Array
    (
    'places' => $object,
    'surname' => 'Submit Query'
);


echo($array['places']->place);

答案 1 :(得分:0)

对于访问数组,我们可以使用“ $ array ['places']”,而使用箭头运算符“->”则可以访问对象。

echo $ array ['places']-> place;

答案 2 :(得分:0)

尝试一下:-

 //create blank object
   $obj = new \stdClass();
   $obj->id = '1';
   $obj->images = '';
   $obj->place = 'palampur'; 

   //create blank arrary
   $arr = array();
   $arr['places'] = $obj;
   $arr['submit'] = 'Submit Query';

   // change object to array     
   $output = (array) $arr['places'];

   echo $output['place'];