1
lianz 2017-03-13 20:20:50 +08:00
ECS 创建实例的
<?php require __DIR__.'/../vendor/aliyun/sdk/TopSdk.php'; echo "Creating Instance ... "; $client = aliyun_get_client(); $req = new Ecs20140526CreateInstanceRequest(); $req->setRegionId($region); $req->setInstanceType($instance_type); $req->setImageId($image_id); @$resp = $client->execute($req); $instanceId = $resp->InstanceId; $req = new Ecs20140526AllocatePublicIpAddressRequest(); $req->setInstanceId($instanceId); @$resp = $client->execute($req); echo "Starting Instance {$instanceId} ... "; $req = new Ecs20140526StartInstanceRequest(); $req->setInstanceId($instanceId); @$resp = $client->execute($req); echo "Done\n"; |
2
jiangle OP @lianz
<?php include_once 'aliyun-php-sdk-core/Config.php'; use Ecs\Request\V20140526 as Ecs; $iClientProfile = DefaultProfile::getProfile("cn-hangzhou","xxx", "xxx"); $client = new DefaultAcsClient($iClientProfile); $request = new Ecs\DescribeRegionsRequest(); $request->setMethod("POST"); $response = $client->getAcsResponse($request); print_r($response);die; ?> 我看官方的是这样的呢? |