如何将变量添加到POST查询

时间:2011-11-02 作者:Fatih Toprak

查询是:

<?php 
// Headlines variable can control admin area
// Its like ; 3,4,5,6
$headlines = ".get_option(\'t_turmanset\').";
query_posts( array( \'numberposts\' => 4, \'post__in\' => array( HOW CAN I ADD HEADLINES ? ) ) );
if ( have_posts() ) : while ( have_posts() ) : the_post(); 

?>
谢谢;)抱歉我的英语不好

1 个回复
SO网友:romulodl

我不确定你是否需要这个,但试着“引爆”它。。。

<?php 
    // Headlines variable can control admin area

    // Does this return the string "2,3,4,5" ???
    $headlines = get_option(\'t_turmanset\');

    query_posts( array( \'numberposts\' => 4, \'post__in\' => explode(",", $headlines) ) );
    if ( have_posts() ) : while ( have_posts() ) : the_post(); 
?>

结束