本文整理汇总了PHP中TPL::setHeaderStr方法的典型用法代码示例。如果您正苦于以下问题:PHP TPL::setHeaderStr方法的具体用法?PHP TPL::setHeaderStr怎么用?PHP TPL::setHeaderStr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TPL
的用法示例。
在下文中一共展示了TPL::setHeaderStr方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doURLRoutingAndCLEANUp
/**
* Will do necessary URL routing and clean-up;
*
* While most of the times we will relly on static URLs, generated by our URL mechanism, most of the times we will need to be
* able to modify the URL or redirect an user to a proper URL, if he has gone haywire. This method does just that, manages
* the URL of the current requested page;
*/
public function doURLRoutingAndCLEANUp()
{
// Redirect to HOME, if nothing set;
if ($_GET->doCount()->toInt() == 0) {
// Set the header key and go home my man ...
TPL::setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
TPL::setHeaderKey(URL::rewriteURL(new A(array(FRONTEND_SECTION_URL)), new A(array(FRONTEND_HOME))), new S('Location'));
}
// -- Fix the double www. and non-www;
if (strpos(URL::rewriteURL(), '://www.') !== FALSE) {
// Moved me permanently ...
$this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
$this->setHeaderKey(URL::rewriteURL()->doToken('://www.', '://'), new S('Location'));
}
// -- Fix the OLD to NEW moving of REWRITE_ENGINE;
if (strpos($_SERVER['REQUEST_URI'], 'index.php/') !== FALSE && REWRITE_ENGINE == TRUE) {
// Moved me permanently ...
$this->setHeaderStr(new S(HDR::HEADER_MOVED_PERMANENTLY));
$this->setHeaderKey(URL::rewriteURL()->doToken('index.php/', _NONE), new S('Location'));
}
}