當前位置: 首頁>>代碼示例>>PHP>>正文


PHP COM::GetErrorDescription方法代碼示例

本文整理匯總了PHP中COM::GetErrorDescription方法的典型用法代碼示例。如果您正苦於以下問題:PHP COM::GetErrorDescription方法的具體用法?PHP COM::GetErrorDescription怎麽用?PHP COM::GetErrorDescription使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在COM的用法示例。


在下文中一共展示了COM::GetErrorDescription方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionCheckComtool

 function actionCheckComtool()
 {
     if (class_exists('COM')) {
         try {
             $objComport = new COM("ActiveXperts.Comport");
             $objComport->Logfile = "C:\\PhpSerialLog.txt";
             $objComport->Device = "COM1";
             $objComport->Baudrate = 9600;
             $objComport->ComTimeout = 1000;
             $objComport->Open();
             print '<br>Check errros of COMport tool using (trying to connect with COM1)';
             if ($objComport->LastError != 0) {
                 if ($objComport->LastError >= 1000 && $objComport->LastError <= 1999) {
                     print '<br>LICENSING ERROR!!!';
                 } else {
                     print '<br>no licensing errors, some errors with com-port connection';
                 }
                 $ErrorNum = $objComport->LastError;
                 $ErrorDes = $objComport->GetErrorDescription($ErrorNum);
                 echo "<br><br>Error sending commands: #{$ErrorNum} ({$ErrorDes}).";
             }
         } catch (Exception $e) {
             print_r($e->getMessage());
         }
         $objComport->Close();
     } else {
         print "Class for work with COM ports is not available";
     }
 }
開發者ID:anton-itscript,項目名稱:WM-Web,代碼行數:29,代碼來源:BugfixController.php

示例2: while

        echo "<BR>";
    }
    echo "Sending 'ATI'...<BR>";
    echo "<BR>";
    $objComport->WriteString("ATI");
    while ($objComport->LastError == 0) {
        echo $objComport->ReadString();
        echo "<BR>";
    }
    echo "Sending 'AT&C0'...<BR>";
    echo "<BR>";
    $objComport->WriteString("AT&C0");
    while ($objComport->LastError == 0) {
        echo $objComport->ReadString();
        echo "<BR>";
    }
} else {
    $ErrorNum = $objComport->LastError;
    $ErrorDes = $objComport->GetErrorDescription($ErrorNum);
    echo "Error sending commands: #{$ErrorNum} ({$ErrorDes}).";
}
echo "Ready.";
$objComport->Close();
?>

   <br>
   <br>
   <hr size="1" color="#707070">
   <font size="1" face="Verdana">This demo uses ActiveXperts Serial Port Component</font>
   </body>
</html>
開發者ID:pcanilho,項目名稱:SMSGateway,代碼行數:31,代碼來源:DummySMS.php


注:本文中的COM::GetErrorDescription方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。