我有一定数量的帖子,每个帖子都包含一个模式(有点弹出),这个模式的HTML在$ html [] var中。下面的代码运行良好,除非您可以看到它不是动态的。用动态值重复var PHP
我已经试过:
$post_count = [1,2,3,4,5,6,7,8,9,10,11,12]; // i've to mannualy add a number according to the number of posts
$counter = 1;
foreach($number_of_modals as $modal){
echo $html[$counter];
$counter++;
}
什么,我需要说明完成
$post_count; // if this val is 3 for example
echo $html[1];
echo $html[2];
echo $html[3];
究竟有什么问题呢? – Rizier123
我喜欢重复'$ html'多次post_count – Paul
得到no。通过array.push在loop.it中将值推送到数组中。没有posts = 3那么foreach循环将用于推送$ post_count数组中的值。 – DevLakshman