Why do you want to ask this question, because PHP seems to use this logic often, so I want to understand the point. Baidu a bit, it seems that the handle is the product under Windows, then other systems such as Linux, Uinx and other operating systems also have this thing? In addition there is the concept of hook, it seems that the handle is also hook, then hook is what? Always feel PHP in a mess.
Also: $_mysqli=new mysqli (' Cocalhost ', ' root ', ' yangfan ', ' CMS '); In this sentence, why is $_mysqli a handle?
I understand it's a variable.
Reply to discussion (solution)
Handle
N. [build] the handle;
Vt. To deal with, manipulate, use, trade, touch
VI. Handling; easy to manipulate
Make a habit of translating a handle
is actually an index of system resources
Passing a resource entity in a program is obviously not as easy as passing its index number.
in PHP
$_mysqli=new mysqli (' Cocalhost ', ' root ', ' yangfan ', ' CMS ');
$_mysqli is an object, of course, a reference to the object is passed, or it can be said to be a handle
$_mysql = mysql_connect (' Cocalhost ', ' root ', ' Yangfan ');
$_mysql is a resource, that is, a handle
Handle
N. [build] the handle;
Vt. To deal with, manipulate, use, trade, touch
VI. Handling; easy to manipulate
Make a habit of translating a handle
is actually an index of system resources
Passing a resource entity in a program is obviously not as easy as passing its index number.
in PHP
$_mysqli=new mysqli (' Cocalhost ', ' root ', ' yangfan ', ' CMS ');
$_mysqli is an object, of course, a reference to the object is passed, or it can be said to be a handle
$_mysql = mysql_connect (' Cocalhost ', ' root ', ' Yangfan ');
$_mysql is a resource, that is, a handle
What is the difference between a variable and a resource?
Let's say this:
Resources are real, like you.
A variable is a carrier, or a name. Like your I.D. 's never going to be shopnc_02, but he's representing you.
A handle is a block or object of memory managed by a system (such as a database, operating system), not a window concept
A reference to a form in window is a handle this is because the official called it. Then functions such as HWND hwnd = AfxGetMainWnd ()->m_hwnd; Look, this type of name is the handle.
In fact open files Open Directory Open database connection can be called a handle but you don't call it that. "Database Connection" "File descriptor"
Resource can be attributed to a handle in PHP