Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/api/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
PHP更新stdClass对象_Php_Api_Object_Stdclass - Fatal编程技术网

PHP更新stdClass对象

PHP更新stdClass对象,php,api,object,stdclass,Php,Api,Object,Stdclass,我想更新stdClass对象以设置一个值 对象: [info] => stdClass Object ( [flags] => Array ( ) 我想将标志设置为: [info] => stdClass Object ( [flags] => Array ( [0] => For

我想更新stdClass对象以设置一个值

对象:

[info] => stdClass Object
    (
        [flags] => Array
            (
            )
我想将
标志设置为:

 [info] => stdClass Object
        (
            [flags] => Array
                (
                    [0] => ForceSSL
                )
我试过了

$response = $services_api->postWithFields("/package/$Package/web/", [
  

  'update' => (object) [
    'info' => [
            'flags'   => 'ForceSSL',
            ]
        ]
    ] );

var_dump( $response );

但是,这显示了一个
NULL
-我做错了什么?

当您将所有内容转换为object时,包括标志。@AlexBarker-抱歉,不确定您的意思?您所拥有的将生成
$obj[“update”]->info->flags
,这不是您所说的。我不知道为什么在没有看到该方法和不知道您调用的服务如何工作的情况下响应为空。我们可以将其转换为聊天吗