【发布时间】:2011-08-06 10:42:08
【问题描述】:
我有这个非常简单的 Wordpress while 循环:
$loop = new WP_Query( args ) );
while ( $loop->have_posts() ) : $loop->the_post();
$data = grab_something( args );
echo $data;
echo "<br/";
endwhile;
这给了我类似的东西:
datastring1
datastring2
anotherdata
somethingelse
and else
and so forth
(...)
我想将这些值从 while 循环中保存为数组或变量,例如。
$data1 = "datastring1";
$data2 = "datastring2";
$data3 = "anotherdata";
(...)
怎么做? :)
谢谢!
【问题讨论】:
标签: php arrays variables while-loop