PHP 卷曲和数组
PHP Curl and Array
我的代码有问题。我正在为我的项目使用 curl。所有需要的数据都正确获取,但在保存过程开始时出现问题。
$SizeParag = sizeof($dr_match[0]);
for($CountParag=1;$CountParag<$SizeParag;$CountParag++) {
$description = ($dr_match[0][$CountParag]);
}
我正在使用这段代码来获取所有段落,但问题是当我保存字符串时 $description
它只保存了最后一段。
我应该如何在保存之前保存所有 $description 的值。预先感谢您对我的帮助。
$description='';
$SizeParag = sizeof($dr_match[0]);
for($CountParag=1;$CountParag<$SizeParag;$CountParag++){
$description .= ($dr_match[0][$CountParag]) . ' ';
}
.= 附加字符串而不是覆盖。如果您希望每个段落都在一个新行上,请将 ' ' 更改为 "\n";
我的代码有问题。我正在为我的项目使用 curl。所有需要的数据都正确获取,但在保存过程开始时出现问题。
$SizeParag = sizeof($dr_match[0]);
for($CountParag=1;$CountParag<$SizeParag;$CountParag++) {
$description = ($dr_match[0][$CountParag]);
}
我正在使用这段代码来获取所有段落,但问题是当我保存字符串时 $description
它只保存了最后一段。
我应该如何在保存之前保存所有 $description 的值。预先感谢您对我的帮助。
$description='';
$SizeParag = sizeof($dr_match[0]);
for($CountParag=1;$CountParag<$SizeParag;$CountParag++){
$description .= ($dr_match[0][$CountParag]) . ' ';
}
.= 附加字符串而不是覆盖。如果您希望每个段落都在一个新行上,请将 ' ' 更改为 "\n";