使用PHP访问Windows注册表

Have you ever woken up in the morning and thought to yourself, “I want to do something crazy today?” Well, if today was one of those mornings then you’re in luck. I’d like to give you a little introduction on accessing the Windows Registry using PHP. PHP… the Registry… CRAZY!

您是否曾经早上醒来,对自己说:“我今天想做点疯狂的事情?” 好吧,如果今天是那些早晨之一,那么您很幸运。 我想给您一些使用PHP访问Windows注册表的介绍。 PHP ...注册表...疯狂!

The Windows Registry is simply a hierarchically structured database in which the Windows operating system and other applications store important configuration information. All sorts of data is stored in the registry: user profiles, file-type associations, hardware information, serial numbers, and more. With functions available from the win32std extension, your Windows-based PHP applications can access the registry too.

Windows注册表只是一个层次结构的数据库,Windows操作系统和其他应用程序在其中存储重要的配置信息。 各种数据都存储在注册表中:用户配置文件,文件类型关联,硬件信息,序列号等。 使用win32std扩展中的可用功能,基于WindowsPHP应用程序也可以访问注册表。

The win32std extension can be downloaded as a pre-compiled library from downloads.php.net/pierre/. Simply drop it into your PHP’s ext folder, update your php.ini file, and restart Apache if necessary. Note that right now the DLLs you’d download are 32-bit, so if you’re using a 64-bit build of WampServer or such then you won’t have much success. You’ll have to either downgrade WampServer to a 32-bit build or try compiling the library yourself.

该win32std扩展可以下载从预编译库downloads.php.net/pierre/ 。 只需将其放入PHP的ext文件夹中,更新php.ini文件,然后在必要时重新启动Apache。 请注意,现在您要下载的DLL是32位的,因此,如果您使用的是WampServer的64位版本,则不会有太大的成功。 您必须将WampServer降级为32位版本,或者尝试自己编译该库。

注册表布局 (The Registry Layout)

The registry has a reputation of being a dark, dangerous and scary place in the Windows operating system. This is probably an over exaggerated fear, but still I’ll reiterate Microsoft’s registry mantra: “Before you modify the registry, back it up and make sure you understand how to restore it if a problem occurs. Improper changes could cause serious problems that may require you to reinstall your operating system.”

该注册表在Windows操作系统中被誉为黑暗,危险和可怕的地方。 这可能是一种过度夸张的担心,但是我仍然要重申Microsoft的注册表原则:“在修改注册表之前,请备份它并确保您了解如果发生问题如何还原它。 不正确的更改可能会导致严重的问题,甚至可能需要您重新安装操作系统。”

So what does this dark, scary place look like? The Windows Registry is divided up into 5 main groups known as keys:

那么这个黑暗,可怕的地方是什么样的呢? Windows注册表分为5个主要组,称为键:

HKEY_CURRENT_CONFIG This key stores information about the computer’s hardware such as monitor resolution and speaker settings. You may see this key abbreviated as HKCC.

HKEY_CURRENT_CONFIG该键存储有关计算机硬件的信息,例如显示器分辨率和扬声器设置。 您可能会看到此密钥的缩写为HKCC。

HKEY_LOCAL_MACHINE This key contains configuration information for the machine such as printers, software and networking information. The key is loaded first and then entries from the user’s profile override various values. You’ll see this key abbreviated as HKLM.

HKEY_LOCAL_MACHINE此项包含机器的配置信息,例如打印机,软件和网络信息。 首先加载密钥,然后来自用户配置文件的条目将覆盖各种值。 您会看到此密钥的缩写为HKLM。

HKEY_USERS This key holds all the profiles for the local user accounts on the machine. Such things as the user’s screensaver selection, theme information and other preferences are stored here. This key is abbreviated as HKU.

HKEY_USERS此项保存计算机上本地用户帐户的所有配置文件。 诸如用户的屏幕保护程序选择,主题信息和其他首选项之

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值