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


PHP COM::regRead方法代码示例

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


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

示例1: detectInkscapePath

function detectInkscapePath()
{
    if (detectOS(HK_OS_WINDOWS)) {
        // automatic attempt to recognize Inkscape path for Windows
        $inkPath = "Inkscape";
        $inkBin = "inkscape.com";
        // try standard locations
        if (isset($_SERVER['ProgramFiles(x86)']) && file_exists($tryPath = "{$_SERVER['ProgramFiles(x86)']}\\{$inkPath}\\{$inkBin}")) {
            return $tryPath;
        }
        if (isset($_SERVER['ProgramW6432']) && file_exists($tryPath = "{$_SERVER['ProgramW6432']}\\{$inkPath}\\{$inkBin}")) {
            return $tryPath;
        }
        // try to read from registry
        if (!extension_loaded('com_dotnet')) {
            dl('php_com_dotnet.dll');
        }
        $sh = new COM('WScript.Shell');
        $checkKeys = ["HKCU\\Software\\Microsoft\\Windows\\CurrentVersion\\App Paths\\inkscape.exe\\", "HKCR\\inkscape.svg\\shell\\open\\command\\"];
        foreach ($checkKeys as $rk) {
            try {
                $regRead = $sh->regRead($rk);
                // no need to check if read passed, because if not, the rest of block won't be executed
                $regRead = str_replace('%1', '', $regRead);
                $tryPath = dirname(trim($regRead, '" ')) . "\\{$inkBin}";
                if (file_exists($tryPath)) {
                    return $tryPath;
                }
            } catch (Exception $e) {
            }
        }
        return '';
        // not found
    } else {
        // automatic attempt to recognize Inkscape path for other systems
        if ($shOut = shell_exec('command -v inkscape')) {
            return trim($shOut);
        }
        // passes if Inkscape is within default path
        // try standard location
        $tryPath = '/usr/bin/inkscape';
        if (file_exists($tryPath)) {
            return $tryPath;
        }
        return '';
        // not found
    }
}
开发者ID:Krzysiu,项目名称:SVGnife,代码行数:48,代码来源:functions.php

示例2: readRegistry

 /**
  * Function reads the registry value of the specified path
  * @param <string> $registryPath Path of the registry value to be read
  * @return <string> Registry value
  * @category Extra
  * <code>
  *  $result = Extra::readRegistry('registry\\path');
  * </code>
  */
 function readRegistry($registryPath)
 {
     try {
         $Wshshell = new COM('WScript.Shell');
         $data = $Wshshell->regRead($registryPath);
         return $data;
     } catch (Exception $err) {
         return $err->getMessage();
     }
 }
开发者ID:johnulist,项目名称:PHP-Library,代码行数:19,代码来源:extra.php

示例3: read

 public function read($key)
 {
     return $this->shell->regRead($key);
 }
开发者ID:pigochu,项目名称:phpdevserver,代码行数:4,代码来源:common.php


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