本文整理汇总了PHP中COM::RegDelete方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::RegDelete方法的具体用法?PHP COM::RegDelete怎么用?PHP COM::RegDelete使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类COM
的用法示例。
在下文中一共展示了COM::RegDelete方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: deleteRegistry
/**
* Function deletes a value from the registry
* @param <string> $folder Folder of the registry value
* @param <string> $key Key of the registry
* @return <boolean> Whether registry was successfully deleted to or not
* @category Extra
* <code>
* $result = Extra::deleteRegistry('registry\\path', 'key');
* </code>
*/
function deleteRegistry($folder, $key)
{
try {
$WshShell = new COM("Wscript.shell");
$registry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder . "\\" . $key;
$result = $WshShell->RegDelete($registry);
echo $key . " is successfully deleted from HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder;
return $result;
} catch (Exception $err) {
return $err->getMessage();
}
return FALSE;
}
示例2: phpreg
function phpreg()
{
$shell1 = new COM("wscript.shell") or die("require windows host");
$action = isset($_POST['action']) ? $_POST['action'] : '';
echo '<div class="actall"><h5>Windows注册表读写</h5></div>';
print <<<END
<TR><form action="" method="post">
<div class="actall"><TD WIDTH=100 VALIGN=TOP ALIGN=CENTER>
路径:<input type="hidden" name="action" value="读取">
<input type="text" name="rpath" value="{$rpath}" size="70">
<input class="bt" type="submit" value="读取"></form><br></TD></TR></div>
END;
$rpath = isset($_POST['rpath']) ? $_POST['rpath'] : '';
$rpath = str_replace("\\\\", "\\", $rpath);
if ($action == "read") {
$out = $shell1->RegRead($rpath);
echo '<pre>' . var_dump($out) . '</pre>';
}
print <<<END
<TR><form action="" method="post">
<div class="actall"><TD WIDTH=100 VALIGN=TOP ALIGN=CENTER>位置:<input type="text" name="wpath" value="{$wpath}" size="70"><BR><br>
类型:<input type="text" name="wtype" value="{$wtype}" size="20"> 值:<input type="text" name="wvalue" value="{$wvalue}" size="30">
<input type="hidden" name="action" value="write"><input class="bt" type="submit" value="写入"></form></TD></TR></div>
END;
$wpath = isset($_POST['wpath']) ? $_POST['wpath'] : '';
$wpath = str_replace("\\\\", "\\", $wpath);
$wtype = isset($_POST['wtype']) ? $_POST['wtype'] : '';
$wvalue = isset($_POST['wvalue']) ? $_POST['wvalue'] : '';
if ($action == "write") {
$shell1->RegWrite($wpath, $wvalue, $wtype);
}
print <<<END
<TR><form action="" method="post">
<div class="actall"><TD WIDTH=100 VALIGN=TOP ALIGN=CENTER>
位置:<input type="hidden" name="action" value="del">
<input type="text" name="dpath" value="{$dpath}" size="70">
<input class="bt" type="submit" value="删"></form></TD></TR></div>
END;
$dpath = isset($_POST['dpath']) ? $_POST['dpath'] : '';
$dpath = str_replace("\\\\", "\\", $dpath);
if ($action == "del") {
$out = $shell1->RegDelete($dpath);
}
}
示例3: delete
public function delete($key)
{
try {
$result = $this->shell->RegDelete($registry);
return $result;
} catch (Exception $e) {
echo "Delete Registry Key : {$key} error." . PHP_EOL;
echo "Exception Code " . $e->getCode() . PHP_EOL;
echo "Exception Message : " . $e->getMessage() . PHP_EOL;
}
return false;
}