如何通过PHP更改云上文件的TTL

发布于 2024-10-05 21:33:02 字数 463 浏览 0 评论 0原文

我试图简单地更改已在我的机架空间云上创建的容器的 TTL 值。我创建了这个 php 脚本,但我对 php 还很陌生,这个项目有点超出我的能力范围。我知道这是可能的,但可以使用一些关于如何使其发挥作用的指导。

这是我的代码:

<?php
require('cloudfiles.php');
$username = "USERNAME";
$key = "API_KEY";
$containname = "CONTAINERNAME";

$auth = new CF_Authentication($username, $key);
$auth->authenticate();
$conn = new CF_Connection($auth);

$container = $conn->get_container($containname);

$container->make_public(1); 
?>

I am trying to simply change the TTL value of a container that is already created on my rackspace cloud. I created this php script but am still new to php and this project is a little over my head. I know it is possible but could use some guidance on how to get this to work.

Here is my code:

<?php
require('cloudfiles.php');
$username = "USERNAME";
$key = "API_KEY";
$containname = "CONTAINERNAME";

$auth = new CF_Authentication($username, $key);
$auth->authenticate();
$conn = new CF_Connection($auth);

$container = $conn->get_container($containname);

$container->make_public(1); 
?>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

dawn曙光 2024-10-12 21:33:02

文档 中的 make_public() 方法说:

启用此容器的内容
通过 CDN 提供服务或调整其 CDN
属性。

所以我想你可以用新的 TTL 值再次调用它。

In the docs for the make_public() method it says:

Either enable this Container's content
to be served via CDN or adjust its CDN
attributes.

So I guess you can just call it again with the new TTL value.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文