Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/sorting/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 在类内设置变量_Php_Pear - Fatal编程技术网

Php 在类内设置变量

Php 在类内设置变量,php,pear,Php,Pear,我使用的是PEAR S3包,我想设置$useSSL=true。 我尽量避免编辑实际的软件包 $s3->usesl->true;pr$s3->usesl(真);不要工作 S3.php:第191行 我的示例代码: require_once 'Services/Amazon/S3.php'; $key = 'xxx'; $secret = 'xxx'; $bucket = 'flyers'; $s3 = Services_Amazon_S3::getAccount($key, $se

我使用的是PEAR S3包,我想设置$useSSL=true。 我尽量避免编辑实际的软件包

$s3->usesl->true;pr$s3->usesl(真);不要工作

S3.php:第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);

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

$s3->useSSL = true;

作为旁注,仅当
usesl
被定义为
$s3
类中的函数时,才使用
$s3->usesl->true
,而
$s3->usesl->true
意味着您试图访问
usesl
对象中名为
true
的属性,我很确定这不是你想要的。

@Mike你可以通过点击我答案左上角数字1下方的
V
符号来感谢我:)。在任何情况下都没有问题,乐意帮忙它确实是一个公共财产:是的/***是否应该使用HTTPS进行连接。*@var bool*/public$usesl=false;