PHP中的" - >"或"=>"

ECh*_*n42 0 php web

我发现自己在PHP编程时使用->=>处于不同的场景中,我想知道这两个运算符之间的区别.

两个例子是:

Cache::section('group')->put('key', $value);
Run Code Online (Sandbox Code Playgroud)

return Response::json(array('key' => 'value'));
Run Code Online (Sandbox Code Playgroud)

仅供参考,我将说明我使用Laravel作为我的框架.

Ale*_*nin 5

http://php.net/manual/en/language.operators.php

=>添加key => value到数组中.->在对象上调用方法或获取对象属性.