[英]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。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.