Home > php教程 > php手册 > PHP应用访问Azure中国区存储服务

PHP应用访问Azure中国区存储服务

WBOY
Release: 2016-06-06 19:52:56
Original
1317 people have browsed it

Windows Azure官方文档介绍了如何在PHP代码中安装Azure SDK并访问Azure存储: http://www.windowsazure.com/en-us/Documentation/Articles/storage-php-how-to-use-blobs/?fb=zh-cn 其中,获取BLOB引用的办法为: $connectionString = 'DefaultEndpointsProt

Windows Azure官方文档介绍了如何在PHP代码中安装Azure SDK并访问Azure存储:

http://www.windowsazure.com/en-us/Documentation/Articles/storage-php-how-to-use-blobs/?fb=zh-cn


其中,获取BLOB引用的办法为:

$connectionString = 'DefaultEndpointsProtocol=[http|https];AccountName=[yourAccount];AccountKey=[yourKey]'


// Create blob REST proxy.
$blobRestProxy = ServicesBuilder::getInstance()->createBlobService($connectionString);
Copy after login

如果要连接国内,我们可以修改connectionstring为
$connectionString = "<span>BlobEndpoint=https://[yourAccount].blob.core.chinacloudapi.cn/;QueueEndpoint=https://[yourAccount].queue.core.chinacloudapi.cn/;TableEndpoint=https://[yourAccount].table.core.chinacloudapi.cn/</span>;DefaultEndpointsProtocol=[http|https];AccountName=[yourAccount];AccountKey=[yourKey]
]";
Copy after login

也就是在连接字符串中加入每个存储服务的端点URL,然后就可以访问国内的存储了。


另外,Azure的PHP SDK源代码在https://github.com/WindowsAzure/azure-sdk-for-php。有兴趣的用户可以自己查看下源码

PHP应用访问Azure中国区存储服务

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Recommendations
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template