多米诺骨牌源
最快捷的苹果资讯

PHP 阿里云 CDN刷新

切换composer 为国内源

composer config -g repo.packagist composer https://packagist.phpcomposer.com

安装 SDK

curl -sS https://getcomposer.org/installer | php
php -d memory_limit=-1 composer.phar require alibabacloud/sdk

PHP 刷新代码

<?php
require __DIR__ . '/cdn/sdk/vendor/autoload.php';
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;

AlibabaCloud::accessKeyClient('id', 'key')
->regionId('cdn')
->asDefaultClient();

try {
$result = AlibabaCloud::rpc()
->product('Cdn')
// ->scheme('https') // https | http
->version('2018-05-10')
->action('RefreshObjectCaches')
->method('POST')
->options([
'query' => [
'RegionId' => "1",
'ObjectPath' => "url",
],
])
->request();
print_r($result->toArray());
} catch (ClientException $e) {
echo $e->getErrorMessage() . PHP_EOL;
} catch (ServerException $e) {
echo $e->getErrorMessage() . PHP_EOL;
}

PHP 预热代码

<?php
use AlibabaCloud\Client\AlibabaCloud;
use AlibabaCloud\Client\Exception\ClientException;
use AlibabaCloud\Client\Exception\ServerException;

// Download:https://github.com/aliyun/openapi-sdk-php
// Usage:https://github.com/aliyun/openapi-sdk-php/blob/master/README.md

AlibabaCloud::accessKeyClient('<accessKeyId>', '<accessSecret>')
->regionId('1')
->asDefaultClient();

try {
$result = AlibabaCloud::rpc()
->product('Cdn')
// ->scheme('https') // https | http
->version('2018-05-10')
->action('PushObjectCache')
->method('POST')
->options([
'query' => [
'RegionId' => "1",
'ObjectPath' => "url",
],
])
->request();
print_r($result->toArray());
} catch (ClientException $e) {
echo $e->getErrorMessage() . PHP_EOL;
} catch (ServerException $e) {
echo $e->getErrorMessage() . PHP_EOL;
}

cdn



未经允许不得转载:多米诺骨牌 » PHP 阿里云 CDN刷新
分享到:

评论 抢沙发

提交评论

  •   昵称 (必填)
  • 邮箱 (必填)
  • 网址 (选填)