Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
如果我使用某个控制器,我想将我的应用程序从 http 重定向到 https。我该怎么做?我真的不想要 .htaccess 重写,因为我使用了很多 Zend 路由,最好是我想要 Zend 中可以做到的方法
如果要对控制器内的所有操作执行此操作,可以init()使用控制器的_redirect()函数在函数中执行重定向:
init()
_redirect()
class MyController extends Zend_Controller_Action { public function init() { $this->_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']); } }