我的代码有问题。我在我的项目中使用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";