Is the handle a concept that is specifically owned by the Windows operating system?

Source: Internet
Author: User
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

  • Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.