php object attribute with dot in name

前端 未结 5 498
借酒劲吻你
借酒劲吻你 2020-11-29 12:28

I have mysql table with collumns like \'operation.date\', \'operation.name\' and etc. After fetching that table data as object with $mysqli->fetch_object() i

5条回答
  •  南笙
    南笙 (楼主)
    2020-11-29 12:36

    Specify aliases in your SQL query like SELECT column AS nameWithoutDots ...
    or access these properties with $object->{'operation.name'}
    or cast the object to array like this: $obj = (array)$obj; echo $obj['operation.name'].

提交回复
热议问题