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.
精彩评论