代码之家  ›  专栏  ›  技术社区  ›  ganjan

从对象php获取值

  •  0
  • ganjan  · 技术社区  · 15 年前

    我在代码中的一个对象上使用了var_dump。 print var_dump( $$user);

    结果: object(stdClass)#35 (1) { ["user1_ready"]=> string(1) "0" } 如何获得该值(在本例中为0)。

    我尝试打印$user,结果 Catchable fatal error: Object of class stdClass could not be converted to string in

    我需要类似的东西 if($$user == 0){echo "error message") else {

    1 回复  |  直到 15 年前
        1
  •  1
  •   Brent    15 年前

    $object->method() $object->property

    $$user->user1_ready

    推荐文章