• <small id='UH8w6'></small><noframes id='UH8w6'>

    1. <i id='UH8w6'><tr id='UH8w6'><dt id='UH8w6'><q id='UH8w6'><span id='UH8w6'><b id='UH8w6'><form id='UH8w6'><ins id='UH8w6'></ins><ul id='UH8w6'></ul><sub id='UH8w6'></sub></form><legend id='UH8w6'></legend><bdo id='UH8w6'><pre id='UH8w6'><center id='UH8w6'></center></pre></bdo></b><th id='UH8w6'></th></span></q></dt></tr></i><div id='UH8w6'><tfoot id='UH8w6'></tfoot><dl id='UH8w6'><fieldset id='UH8w6'></fieldset></dl></div>
    2. <tfoot id='UH8w6'></tfoot>

        <bdo id='UH8w6'></bdo><ul id='UH8w6'></ul>

    3. <legend id='UH8w6'><style id='UH8w6'><dir id='UH8w6'><q id='UH8w6'></q></dir></style></legend>

        如何访问在 php 中命名为变量的对象属性?

        How can I access an object property named as a variable in php?(如何访问在 php 中命名为变量的对象属性?)
        <legend id='tRXgE'><style id='tRXgE'><dir id='tRXgE'><q id='tRXgE'></q></dir></style></legend>
        • <small id='tRXgE'></small><noframes id='tRXgE'>

            <i id='tRXgE'><tr id='tRXgE'><dt id='tRXgE'><q id='tRXgE'><span id='tRXgE'><b id='tRXgE'><form id='tRXgE'><ins id='tRXgE'></ins><ul id='tRXgE'></ul><sub id='tRXgE'></sub></form><legend id='tRXgE'></legend><bdo id='tRXgE'><pre id='tRXgE'><center id='tRXgE'></center></pre></bdo></b><th id='tRXgE'></th></span></q></dt></tr></i><div id='tRXgE'><tfoot id='tRXgE'></tfoot><dl id='tRXgE'><fieldset id='tRXgE'></fieldset></dl></div>
            • <bdo id='tRXgE'></bdo><ul id='tRXgE'></ul>
              <tfoot id='tRXgE'></tfoot>
                <tbody id='tRXgE'></tbody>

                  本文介绍了如何访问在 php 中命名为变量的对象属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  以 JSON 编码的 Google API 返回了这样的对象

                  A Google APIs encoded in JSON returned an object such as this

                  [updated] => stdClass Object
                  (
                   [$t] => 2010-08-18T19:17:42.026Z
                  )
                  

                  谁知道我如何访问 $t 值?

                  Anyone knows how can I access the $t value?

                  $object->$t 明显返回

                  注意:未定义变量:t in/usr/local/...

                  Notice: Undefined variable: t in /usr/local/...

                  致命错误:无法访问/.... 中的空属性

                  Fatal error: Cannot access empty property in /....

                  推荐答案

                  由于您的属性名称是字符串 '$t',您可以这样访问它:

                  Since the name of your property is the string '$t', you can access it like this:

                  echo $object->{'$t'};
                  

                  或者,您可以将属性的名称放在一个变量中并像这样使用它:

                  Alternatively, you can put the name of the property in a variable and use it like this:

                  $property_name = '$t';
                  echo $object->$property_name;
                  

                  您可以在 repl.it 上看到这两种操作:https://repl.it/@jrunning/SpirtedTroubledWorkspace

                  You can see both of these in action on repl.it: https://repl.it/@jrunning/SpiritedTroubledWorkspace

                  这篇关于如何访问在 php 中命名为变量的对象属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Proxy Authentication Required with cURL(cURL 需要代理身份验证)
                  How to use a SOCKS 5 proxy with cURL?(如何使用带有 cURL 的 SOCKS 5 代理?)
                  How to use HTTP_X_FORWARDED_FOR properly?(如何正确使用 HTTP_X_FORWARDED_FOR?)
                  file_get_contents behind a proxy?(代理后面的 file_get_contents ?)
                  pecl install cassandra throws: quot;error: Unable to load libcassandraquot;(pecl install cassandra 抛出:“错误:无法加载 libcassandra)
                  Installing php datastax driver on ubuntu(在 ubuntu 上安装 php datastax 驱动)
                  <tfoot id='7aNdk'></tfoot>
                      <bdo id='7aNdk'></bdo><ul id='7aNdk'></ul>

                      <small id='7aNdk'></small><noframes id='7aNdk'>

                      • <legend id='7aNdk'><style id='7aNdk'><dir id='7aNdk'><q id='7aNdk'></q></dir></style></legend>

                          1. <i id='7aNdk'><tr id='7aNdk'><dt id='7aNdk'><q id='7aNdk'><span id='7aNdk'><b id='7aNdk'><form id='7aNdk'><ins id='7aNdk'></ins><ul id='7aNdk'></ul><sub id='7aNdk'></sub></form><legend id='7aNdk'></legend><bdo id='7aNdk'><pre id='7aNdk'><center id='7aNdk'></center></pre></bdo></b><th id='7aNdk'></th></span></q></dt></tr></i><div id='7aNdk'><tfoot id='7aNdk'></tfoot><dl id='7aNdk'><fieldset id='7aNdk'></fieldset></dl></div>
                              <tbody id='7aNdk'></tbody>