简体   繁体   English

如何在Zend Framework 1.12中几秒钟后刷新/重定向页面

[英]How to refresh/redirect page after some seconds in Zend Framework 1.12

I came across to an obstacle for me when i wanted to output a message for couple seconds in the page then redirect the user after to a different page. 当我想在页面中输出消息几秒钟,然后将用户重定向到另一个页面时,遇到了一个障碍。 i know we can do it with plain php as in header("Refresh:4; url=http://www.targeturl.com"); 我知道我们可以使用header("Refresh:4; url=http://www.targeturl.com");纯php来做到这一点header("Refresh:4; url=http://www.targeturl.com"); How can i do the same thing in Zend Framework? 我如何在Zend Framework中做同样的事情? Thank you. 谢谢。

Either put a sleep before the redirect 在重定向之前先入睡

sleep(4);
$this->view->_redirect('http://www.targeturl.com');

or use meta refresh 或使用元刷新

$this->headMeta()->appendHttpEquiv('Refresh', '4;URL=http://www.targeturl.com');

I think the latter is what you are after. 我认为后者就是您所追求的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM