
<pre class="wp-block-syntaxhighlighter-code">
array(134) {
[14]=>
bool(false)
[15]=>
string(0) ""
[16]=>
string(6) "center"
[17]=>
string(7) "#ffffff"
[18]=>
string(95) "https://xxx.s3.us-east-2.amazonaws.com/image/736589fac73c7dfdbf61efadb49a95fb9af16efb.jpeg"
[19]=>
string(30) "<p>Image with text overlay</p>"
[20]=>
string(8) "Shop Now"
}
</pre>
foreach ($images->all() as $image) {
var_dump($image, filter_var($image, FILTER_VALIDATE_URL));
echo "\n";
}
<pre class="wp-block-syntaxhighlighter-code">
string(11) "collections"
bool(false)
bool(false)
bool(false)
string(6) "center"
bool(false)
string(4) "grid"
bool(false)
string(18) "this is collection"
bool(false)
string(19) "main-index-carousel"
bool(false)
string(5) "slide"
bool(false)
bool(false)
bool(false)
string(0) ""
bool(false)
string(6) "center"
bool(false)
string(7) "#ffffff"
bool(false)
string(95) "https://xxx.us-east-2.amazonaws.com/image/736589fac73c7dfdbf61efadb49a95fb9af16efb.jpeg"
string(95) "https://xxx.us-east-2.amazonaws.com/image/736589fac73c7dfdbf61efadb49a95fb9af16efb.jpeg"
string(30) "<p>Image with text overlay</p>"
bool(false)
string(8) "Shop Now"
bool(false)
string(26) "internal://policy_pages/29"
string(26) "internal://policy_pages/29"
</pre>

$images = collect($data['sections'])->flatten()->reject(function ($image) {
return !filter_var($image, FILTER_VALIDATE_URL);
})->reject(function ($image) {
return !in_array(parse_url($image, PHP_URL_SCHEME), ['http', 'https']);
});
var_dump($images);
object(Illuminate\Support\Collection)#4918 (1) {
["items":protected]=>
array(4) {
[10]=>
string(107) "https://cdn.xxx.com/image/2022/04/fa5d91ba9fd60ef1b050560895d2f15c02852f0d9669654de4c01c8b404af3f3.jpeg"
[24]=>
string(95) "https://xxx.us-east-2.amazonaws.com/image/736589fac73c7dfdbf61efadb49a95fb9af16efb.jpeg"
[41]=>
string(95) "https://xxx.us-east-2.amazonaws.com/image/7a204816a9625475044c8196bfb154b39aa3f12b.jpeg"
[129]=>
string(95) "https://xxx.us-east-2.amazonaws.com/image/736589fac73c7dfdbf61efadb49a95fb9af16efb.jpeg"
}
}
PHP / Laravel / Yii2 老项目维护与长期技术支持
如果你的 PHP / Laravel / Yii2 项目已经上线,但遇到原开发离职、Bug 长期无人修复、接口不稳定、性能下降、代码难以接手等问题,可以联系我做一次远程技术排查。
适合以下情况:
✅ 老旧 PHP 系统无人维护
✅ Laravel / Yii2 项目 Bug 修复
✅ 后台管理系统小功能迭代
✅ RESTful API 接口排查
✅ MySQL / Redis / Nginx 性能问题
✅ 长期远程兼职维护
可先从一次小问题开始:
✅ 线上报错排查
✅ 接口异常分析
✅ 慢查询与性能瓶颈定位
✅ 代码结构初步评估
✅ 部署环境与日志检查
如需咨询,请联系我,并注明:PHP 维护咨询。
联系方式:
Telegram:@shuijingwan
微信:13980074657
邮箱:shuijingwanwq@gmail.com

发表回复