當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。