【问题标题】:How to access an object variable with @before如何使用@before 访问对象变量
【发布时间】:2016-12-16 16:56:15
【问题描述】:

在我需要获取的对象中:attributes->id

SimpleXMLElement Object
(
    [@attributes] => Array
        (
            [id] => 30
            [field_type] => text
            [base_type] => text
        )

    [label] => Service
    [nowrap] => 0
    [bold] => 0
    [required] => 0
    [appears_by_default] => 1
    [find_enabled] => 1
    [allow_new_choices] => 0
    [sort_as_given] => 1
    [carrychoices] => 1
    [foreignkey] => 0
    [unique] => 0
    [doesdatacopy] => 1
    [fieldhelp] => SimpleXMLElement Object
        (
        )

    [num_lines] => 1
    [maxlength] => 0
    [append_only] => 0
    [allowHTML] => 0
)

【问题讨论】:

  • $object->getAttribute('id')
  • $att = "id";$id = (string)$field->attributes()->$att;

标签: php variables object


【解决方案1】:
$att = "id";
$fids[] = (string)$field->attributes()->$att;

【讨论】:

    猜你喜欢
    • 2014-01-31
    • 2021-01-24
    • 1970-01-01
    • 1970-01-01
    • 2012-06-30
    • 1970-01-01
    • 1970-01-01
    • 2016-03-04
    • 2015-07-09
    相关资源
    最近更新 更多