2014-02-13 13 views
0

像这样。我想要刷新消息。如何在Phalcon中使用冲洗功能

class TestController extends \Phalcon\Mvc\Controller{ 

public function indexAction() 
{ 
    for ($i = 0; $i < 10; $i++) 
    { 
    echo $i . '<br>'; 
    flush(); 
    ob_flush(); 
    sleep(1); 
    }  
} 
} 

此代码不起作用,任何想法?

+0

公共/私人功能需要在课堂上。例如, '类主要{ 公共功能的indexAction() { 为($ I = 0; $ I <10; $ I ++){ 回声 $ I。 '
'; flush(); ob_flush(); sleep(1); } } }' – Cilan

回答

0

只是打印输出和往常一样:

class TestController extends \Phalcon\Mvc\Controller 
{ 

public function indexAction() 
{ 
    for ($i = 0; $i < 10; $i++) 
    { 
    echo $i . '<br>';   
    }  
} 

在您看来,地方的信息必须表明:

伏:

{{ content() }} 

纯PHP:

<?php echo $this->getContent(); ?>