Пример #1
0
 private function _checkUrl($url)
 {
     if (empty($url)) {
         return Url::redirect(Url::getRoot('public'));
     }
     return filter_var($url, FILTER_SANITIZE_URL);
 }
Пример #2
0
<?php

/*
 * Public errors handling
 */
use WebSupportDK\PHPHttp\Url;
switch (Url::getError()) {
    case 404:
        Url::redirect(Url::getRoot('public') . 'error/code/404');
        break;
    case 42:
        Url::redirect(Url::getRoot('public') . 'error/code/42');
        break;
    default:
        break;
}
Пример #3
0
<?php

// load class
require_once '../src/Url.php';
// use class
use WebSupportDK\PHPHttp\Url;
// redirect with header location to url
Url::redirect($location = 'http://test.com/home');
// redirect back to previous page with javascript
Url::redirectBack();