簡體   English   中英

如何循環回顯變量?

[英]How to loop an echoed variable?

我目前正在嘗試:

$custom_image = usp_get_meta(false, 'usp-custom-4');
$custom_image = htmlspecialchars_decode($custom_image);
$custom_image = nl2br($custom_image);
$custom_image = preg_replace('/<br \/>/iU', '', $custom_image);
foreach($custom_image as $img) {
    echo $img;
}

但是我明白了

警告:為...中的foreach()提供了無效的參數

一個簡單的假設即可解決:

更改$custom_image = preg_replace('/<br \\/>/iU', '', $custom_image);

$custom_image = explode('<br />',$custom_image);

然后,您可以循環播放。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM