在类中设置变量

时间:2012-04-11 07:50:14

标签: php pear

我正在使用PEAR S3 Package,我想设置$ useSSL = true。 我正在避免编辑实际包裹,我可以。

$ S3-> useSSL->真; pr $ s3-> useSSL(true);不工作。

S3.php:http://pastebin.com/4sZ19mR4第191行

我的示例代码:

require_once 'Services/Amazon/S3.php';

$key    = 'xxx';
$secret = 'xxx';
$bucket = 'flyers';

$s3     = Services_Amazon_S3::getAccount($key, $secret);
$s3->useSSL->true;
print $s3->getURL();
$bucket = $s3->getBucket($bucket);

1 个答案:

答案 0 :(得分:2)

如果useSSL确实是$s3的公共属性,您可以执行以下操作:

$s3->useSSL = true;

作为旁注,仅当$s3->useSSL(true)被定义为useSSL类中的函数时才使用$s3,而$s3->useSSL->true表示您正尝试访问true useSSL$s3对象中名为{{1}}的属性,我很确定这不是您想要的。

相关问题