require_once "WindowsAzure/WindowsAzure.php"; require_once 'PHPUnit\autoload.php';
use WindowsAzure\Common\ServicesBuilder; use WindowsAzure\Common\ServiceException;
// Create Connection String $connectionString = "DefaultEndpointsProtocol=http;AccountName=[yourAccount];AccountKey=[yourKey]"; // Create queue REST proxy. $queueRestProxy = ServicesBuilder::getInstance()->createQueueService($connectionString);
<?php require_once "WindowsAzure/WindowsAzure.php"; require_once 'PHPUnit\autoload.php'; use WindowsAzure\Common\ServicesBuilder; use WindowsAzure\Common\ServiceException; use WindowsAzure\Queue\Models\CreateQueueOptions; // Create Connection String $connectionString = "DefaultEndpointsProtocol=http;AccountName=[yourAccount];AccountKey=[yourKey]"; // Create queue REST proxy. $queueRestProxy = ServicesBuilder::getInstance()->createQueueService($connectionString); // OPTIONAL: Set queue metadata. $createQueueOptions = new CreateQueueOptions(); $createQueueOptions->addMetaData("key1", "value1"); $createQueueOptions->addMetaData("key2", "value2"); try { // Create queue. $queueRestProxy->createQueue("myqueue", $createQueueOptions); echo "Queue 'myqueue' has been created."; } catch(ServiceException $e){ // Handle exception based on error codes and messages. // Error codes and messages are here: // http://msdn.microsoft.com/en-us/library/windowsazure/dd179446.aspx $code = $e->getCode(); $error_message = $e->getMessage(); echo $code.": ".$error_message."<br />"; } ?>
ช่วยกันสนับสนุนรักษาเว็บไซต์ความรู้แห่งนี้ไว้ด้วยการสนับสนุน Source Code 2.0 ของทีมงานไทยครีเอท