问题
I would like to add an curl Option in the method listDir to be able to list the files
the connection method works just fine but when am trying to append the cOptions
array and add $this->cOptions[CURLOPT_CUSTOMREQUEST]="PROPFIND";
it doesn work!!!! and help clue what to do?
thanks in Advance
<?php
class test{
public static $cOptions;
public function connect(){
$ch = curl_init();
$this->cOptions=array(
CURLOPT_URL =>"111",
CURLOPT_RETURNTRANSFER=>1
);
$response = curl_exec($ch);
curl_close($ch);
return $response;
}
public function listDir(){
$this->cOptions[CURLOPT_CUSTOMREQUEST]="PROPFIND";
$connection=$this->connect();
return $connection; ///// should list files
}
}
$myclass=new test();
$myclass->connect();
$myclass->listDir();
来源:https://stackoverflow.com/questions/65554185/override-an-array-from-different-method