【发布时间】:2017-01-15 05:36:49
【问题描述】:
我有以下几点:
public function go(){
for($x=0;$x<=31;$x++) {
$this->get_answerrules($x);
$DoneTime+=$DoneTime;
}
echo $gmdate("i:s", $DoneTime);;
}
和
public function get_answerrules($x){
...
...
...
if($response = $this->request($data)){
$obj = json_decode($response,true);
foreach($obj as $file) {
$Time += $file['batch_dura'];
}
$DoneTime = $Time;
return $DoneTime;
}else{}
}
如何从 31 个 for 循环周期中获取值并将它们相加?
现在我的结果是空白的。
【问题讨论】:
-
因为你不知道变量的作用域。
标签: php for-loop return return-value