开发者

What does some_name()->some_func() mean in PHP?

开发者 https://www.devze.com 2023-03-24 05:39 出处:网络
What does some_name()->some_func() mean in PHP? I found something like this in a user controller method in a CodeIgniter application. I was wondering what that is and I couldn\'t find it anywhere. Co

What does some_name()->some_func() mean in PHP?

I found something like this in a user controller method in a CodeIgniter application. I was wondering what that is and I couldn't find it anywhere. Code sample:

try
{
  开发者_Go百科Connect()->login($_POST);
}
  catch(Exception $e)
{
...


It means Connect() returns an object, and you're calling the login() method of that object.


Means what it means in a lot of other languages, execute some_name() to object returned by some_name() execute some_func().

In your example it means execute Connect() (which might be a Class constructor) and then execute login with the POST array.

Obviously one of those raises an exception.

0

精彩评论

暂无评论...
验证码 换一张
取 消