Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在尝试使用以下 php 代码从对象中获取数组。
$abstract = $view->result[0]->nye.abstract;
由于“。”,我收到了语法错误。在 nye.abstract。反正有这个问题吗?
仅供参考,该视图是一个drupal视图
$abstract = $view->result[0]->{'nye.abstract'};
解决此问题的2种方法:
按变量:
$nye="nye.abstract"; $abstract = $view->result[0]->$nye;
带大括号: