我正在尝试将数组数据从控制器传递到视图,但视图丢失了“Yii 格式”(标题引导程序),标题没有出现,只显示“平面文本”。
当我尝试使用array_pop.
查看:magazines.php
<?php
/* @var $this SiteController */
$this->pageTitle=Yii::app()->name;
?>
<h3>
    <?php    
        $aux_string = "";   
        foreach ( $files_format as $aux_string ) {
            $aux_string->array_pop($files_format);
        }
    ?>
</h3>
控制器:SiteController.php
public function actionMagazines()
{
            $path="pdfs/";
            $directory=dir($path);
            $files=array();
            while (false !== ($entry = $directory->read()))
            {   
                 if($entry!="."&&$entry!=".."){
                    array_push($files, $entry);
                    print_r($files);
                 }
            }
            $this->render('magazines', array('files_format'=> $files));
}
在另一种方式中,如果我不使用 array_pop ,“Yii 格式”将保持不变(下面,带有array_pop注释的代码行是正确显示视图的注释)
           ...
           //$aux_string->array_pop($files_format);
           ...