本文整理汇总了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
}
}
示例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();
}
}
示例3: read
public function read($key)
{
return $this->shell->regRead($key);
}