当前位置: 首页>>代码示例>>PHP>>正文


PHP Output::redirect方法代码示例

本文整理汇总了PHP中Output::redirect方法的典型用法代码示例。如果您正苦于以下问题:PHP Output::redirect方法的具体用法?PHP Output::redirect怎么用?PHP Output::redirect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Output的用法示例。


在下文中一共展示了Output::redirect方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: route

 /**
  * redirect request to a host by hashing the given url
  * @param $url
  * @param $numberOfHost
  */
 public static function route($url, $numberOfHost)
 {
     $hashNode = static::strHash($url, $numberOfHost);
     $redirectUrl = "http://tumblr-images-{$hashNode}.appspot.com/main.php?url={$url}";
     $redirectUrl = static::encodeCjkChars($redirectUrl);
     Output::redirect($redirectUrl);
 }
开发者ID:gonejack,项目名称:tumblr-images-memcached,代码行数:12,代码来源:router.php

示例2: action_register

 public function action_register()
 {
     if (\Auth::check()) {
         \Session::set_flash('error', 'FLASH: Can\'t register while logged in, log out first.');
         \Output::redirect('myauth');
     }
     // The same fields as the example above
     $val = \Validation::factory('myauth2');
     $val->add_field('username', 'Your username', 'required|min_length[3]|max_length[20]');
     //        $val->add_field('username', 'Your username', 'required|min_length[3]|max_length[20]|unique[simpleauth.username]');
     $val->add_field('password', 'Your password', 'required|min_length[3]|max_length[20]');
     $val->add_field('email', 'Email', 'required|valid_email');
     // run validation on just post
     if ($val->run()) {
         if (\Auth::instance()->create_user($val->validated('username'), $val->validated('password'), $val->validated('email'), '100')) {
             \Session::set_flash('notice', 'FLASH: User created.');
             \Output::redirect('myauth');
         } else {
             throw new Exception('Smth went wrong while registering');
         }
     } else {
         // validation failed
         if ($_POST) {
             $data['username'] = $val->validated('username');
             $data['login_error'] = 'All fields are required.';
         } else {
             $data['login_error'] = false;
         }
     }
     $this->template->title = 'Myauth &raquo Register';
     $this->template->login_error = @$data['login_error'];
     $this->template->content = \View::factory('register');
 }
开发者ID:huglester,项目名称:fuel-uploadify,代码行数:33,代码来源:myauth.php

示例3: enable

 function enable()
 {
     $id = $this->uri->get('id');
     if ($id != '') {
         $ret = $this->user_model->updateRecord(array('user_canlogin' => '1'), array('user_id' => $id));
     }
     Output::redirect($this->config['base_url'] . $this->ctrler . '/');
 }
开发者ID:cyberorca,项目名称:dfp-api,代码行数:8,代码来源:user_admin.php

示例4: get_index

 protected function get_index()
 {
     $conf = Config::getInstance();
     if (Session::isLogged()) {
         Output::redirect(WWW_PATH);
     }
     $conf = Config::getInstance();
     $tpt = new TemplateRes(array("title" => $conf->get("title"), "description" => $conf->get("description"), "favicon" => $conf->get("favicon", null)));
     $tpt->output("login.php");
 }
开发者ID:DavBfr,项目名称:BlogMVC,代码行数:10,代码来源:LoginRest.class.php

示例5: before

 public function before()
 {
     parent::before();
     if (!\Auth::check()) {
         \Output::redirect('myauth');
     }
     \Asset::remove_path('assets/');
     \Asset::add_path('assets/uploadify/');
     $this->template->css = \Asset::css(array('style.css'), array(), 'layout', false);
     $this->template->js = \Asset::js(array('jquery-1.3.2.min.js', 'swfobject.js', 'jquery.uploadify.v2.1.0.min.js', 'jquery.application.js'), array(), 'layout', false);
 }
开发者ID:huglester,项目名称:fuel-uploadify,代码行数:11,代码来源:uploadify.php

示例6: main

/**
 * @param $isHashHost Boolean Is this host a router
 * @param $hostNumber Number How many host there
 * @param $packImages Boolean make a zip pack for images?
 */
function main($isHashHost, $hostNumber, $packImages)
{
    $url = isset($_GET['url']) ? $_GET['url'] : '';
    # URL given
    if ($url) {
        # it's an image url
        if (Input::isImageUrl($url)) {
            Output::redirect($url);
        } elseif ($isHashHost) {
            Router::route($url, $hostNumber);
        } else {
            $mc = new mc();
            Input::loadMemcached($mc);
            Output::loadMemcached($mc);
            Handler::loadMemcached($mc);
            Handler::handle($url, $packImages);
        }
    } else {
        exit_script('Hello Tumblr!');
    }
}
开发者ID:gonejack,项目名称:tumblr-images-memcached,代码行数:26,代码来源:main.php

示例7: save

 function save()
 {
     //echoPre($_POST);
     //echoPRe($_FILES);
     //die;
     if (isPost() && post('vContent')) {
         $whatHappenDt = array('what_happen_order' => post('vOrder'), 'what_happen_flag' => post('vFlag'), 'what_happen_url' => post('vUrl'), 'what_happen_content' => post('vContent'), 'what_happen_image' => post('vImage'), 'what_happen_id' => post('vId'), 'what_happen_schedule' => post('vSchedule'), 'what_happen_headtorial' => post('what_happen_headtorial') == "headtorial" ? "1" : "0", 'what_happen_schedule_end' => post('vSchedule_end'));
         //echoPre($whatHappenDt);   die;
         $whatHappenDateDt = array('what_happen_id' => post('vId'), 'what_happen_schedule' => post('vSchedule'));
         if (post('vId')) {
             $what_happen_id = post('vId');
             $this->what_happen_model->updateRecord($whatHappenDt, array('what_happen_id' => $what_happen_id));
             //$this->what_happen_model->updateDateRecord($whatHappenDateDt, array('what_happen_id' => $what_happen_id));
         } else {
             $what_happen_id = $this->what_happen_model->insertRecord($whatHappenDt);
             //$whatHappenDateDt['what_happen_id'] = $what_happen_id;
             //$this->what_happen_model->insertDateRecord($whatHappenDateDt);
         }
         //processing ilustration upload
         $whatHappenDt['what_happen_schedule'] = post('vSchedule');
         $this->processIlustration($whatHappenDt, $what_happen_id);
         @header('Location: ' . $this->config['base_url'] . $this->ctrler . '/&s=success' . (post('page') != '' ? '&page=' . post('page') : ''));
     } else {
         //$this->redirect('/'.$this->ctrler.'/addnews/');
         Output::redirect($this->config['base_url'] . $this->ctrler . '/add/');
     }
 }
开发者ID:cyberorca,项目名称:dfp-api,代码行数:27,代码来源:whathappen.php

示例8: handle

 public static function handle($url, $packImages = false)
 {
     $postParam = static::parseUrlParam($url);
     $quickInfo = null;
     # try to process it
     try {
         # a valid tumblr url given
         if ($postParam) {
             $cachedInfo = Input::fetchQuickInfoCache($postParam);
             # quick response info found
             if ($cachedInfo) {
                 # make just header response
                 if ($_SERVER['REQUEST_METHOD'] === 'HEAD') {
                     syslog(LOG_INFO, "HEAD Response.");
                     foreach ($cachedInfo['headers'] as $header) {
                         header($header);
                     }
                 } else {
                     syslog(LOG_INFO, "Content Response.");
                     $content = $cachedInfo['content'];
                     switch ($cachedInfo['type']) {
                         case 'html':
                             Output::echoHtmlFile($content);
                             break;
                         case 'video':
                         case 'singlePhoto':
                             Output::redirect($content);
                             break;
                         case 'htmlZip':
                             Output::echoZipFile($content);
                             break;
                         case 'error':
                             Output::echoTxtFile($content);
                             break;
                     }
                 }
             } else {
                 $postJSON = Input::fetchPostInfoCache($postParam) ?: Input::queryTumblrApi($postParam);
                 # post json gotten
                 if ($postJSON) {
                     # save post info to memcached
                     Output::setPostInfoCache($postParam, $postJSON);
                     $postInfo = $postJSON['posts'][0];
                     $postType = Content::parsePostType($postInfo);
                     $parserName = 'parse' . ucfirst($postType);
                     switch ($postType) {
                         case 'audio':
                         case 'answer':
                         case 'conversation':
                         case 'link':
                         case 'regular':
                         case 'quote':
                             $output = Content::$parserName($postInfo);
                             $zipStr = Content::getHtmlZipPack($output);
                             Output::echoZipFile($zipStr);
                             $quickInfo = ['type' => 'htmlZip', 'content' => $zipStr];
                             break;
                         case 'video':
                             $output = Content::$parserName($postInfo);
                             # video source parsed
                             if ($output) {
                                 Output::redirect($output);
                                 $quickInfo = ['type' => 'video', 'content' => $output];
                             } else {
                                 $errMsg = "Can't not parse video post, maybe it's too complicated to get the video source out.";
                                 throw new Exception($errMsg);
                             }
                             break;
                         case 'unknow':
                         case 'photo':
                         default:
                             $photoUrls = Content::$parserName($postInfo);
                             $photoCount = count($photoUrls);
                             # photo found
                             if ($photoCount > 0) {
                                 # one photo
                                 if ($photoCount === 1) {
                                     Output::redirect($photoUrls[0]);
                                     $quickInfo = ['type' => 'singlePhoto', 'content' => $photoUrls[0]];
                                 } else {
                                     # to make a images pack
                                     if ($packImages) {
                                         $imagesCache = Input::fetchImagesCache($photoUrls);
                                         $total = count($photoUrls);
                                         $cached = count($imagesCache);
                                         $fetched = 0;
                                         $startTime = microtime(true);
                                         # get images
                                         $imagesCont = array_fill_keys($photoUrls, null);
                                         $randomOrder = array_values($photoUrls);
                                         shuffle($randomOrder);
                                         foreach ($randomOrder as $imgUrl) {
                                             $fileName = basename($imgUrl);
                                             # image in cache found
                                             if (isset($imagesCache[$fileName])) {
                                                 $imagesCont[$imgUrl] =& $imagesCache[$fileName];
                                             } else {
                                                 $imagesCont[$imgUrl] = Input::fetchImage($imgUrl);
                                                 # fetch from network
                                                 $imagesCont[$imgUrl] && static::$mc->singleSet($fileName, $imagesCont[$imgUrl]);
//.........这里部分代码省略.........
开发者ID:gonejack,项目名称:tumblr-images-memcached,代码行数:101,代码来源:handler.php

示例9: putInTrash

 public function putInTrash()
 {
     if ($this->uri->get('id')) {
         $whereCond = array('id' => $this->uri->get('id'));
         $this->tags_model->deleteTagRecord($whereCond);
     }
     #redirecting page after deleting process
     Output::redirect($this->config['base_url'] . 'tag-management/');
 }
开发者ID:cyberorca,项目名称:dfp-api,代码行数:9,代码来源:tag.php

示例10: preview

 function preview()
 {
     $id = $this->uri->get('id');
     if (isset($id)) {
         $ret = $arr = $this->_get_edit_news($id);
         $dt = array('prefix_title' => 'Photo news Preview', 'title' => 'Photo news Preview', 'top_active' => $this->method_by_url[$this->ctrler]['parent_id'], 'sub_menu' => $this->method_by_url[$this->ctrler]['sub_id'], 'content' => $this->provideNewsPreview($ret), 'custom_css' => array($this->config['assets_css_url'] . 'dropzone.css', $this->config['assets_css_url'] . 'news/n_news.css'), 'custom_js' => array($this->config['assets_js_url'] . 'news/n_news.js'));
     } else {
         Output::redirect($this->config['base_url'] . $this->ctrler . '/');
         exit;
     }
     $this->render('url/_templates', $dt);
 }
开发者ID:cyberorca,项目名称:dfp-api,代码行数:12,代码来源:photonews.php

示例11: resetpassword

    function resetpassword($code)
    {
        $sts = false;
        if ($code) {
            $where = "user_activation_hash='" . $code . "'";
            $row = $this->user_model->get_user($where);
            if (is_array($row) && count($row) > 0) {
                $row = $row[0];
                $change = $this->user_model->updatePassword($row['user_id']);
                if ($change) {
                    $to = $row['user_email'];
                    $toname = $row['user_realname'];
                    $subject = '[' . strtoupper($row['user_realname']) . '] Password reset';
                    $message = '
                        Dear ' . $toname . '<br /><br />
                        Your password has been successfully updated.<br />
                        Your new account is :<br />
                        User : ' . $row['user_email'] . '<br />
                        Password : ' . $change['new_password'] . '<br />
                        Change your password immediatly after you logon into the Application.<br /><br />

                        Regards.
                    ';
                    $sts = send_email($to, $subject, $message);
                }
            }
        }
        if ($sts) {
            $dt = array('url_home' => BASE_URL);
            $content = $this->view("box/_user_reset_pass", $dt, true);
            $this->index($content);
        } else {
            Output::redirect($this->config['base_url']);
        }
    }
开发者ID:cyberorca,项目名称:dfp-api,代码行数:35,代码来源:index.php

示例12: savenews

 function savenews()
 {
     if (isPost() && post('news_title')) {
         $newsDt = array('news_id' => post('news_id'), 'news_entry' => date('Y-m-d H:i:s'), 'news_level' => post('news_level'), 'news_top_headline' => '0', 'news_editor_pick' => post('news_editor_pick') ? '1' : '0', 'news_category' => json_encode(array(post('news_category'))), 'news_title' => post('news_title'), 'news_subtitle' => post('news_subtitle'), 'news_synopsis' => post('news_lead'), 'news_content' => post('news_content'), 'news_image_headline' => '0', 'news_imageinfo' => post('news_imageinfo'), 'news_url' => post('news_subtitle') ? url_title(post('news_title') . '-' . post('news_subtitle')) : url_title(post('news_title')), 'news_date_publish' => post('news_date_publish') ? post('news_date_publish') : date('Y-m-d H:i:s'), 'news_invalid' => '0', 'news_user_id' => sess('usr_id'), 'news_type' => '0', 'news_reporter' => $this->processReporter(post('news_reporter')), 'news_editor' => json_encode(array(array('email' => sess('usr_email'), 'user_fullname' => sess('usr_fullname')))), 'news_initial' => '', 'news_photographer' => $this->processReporter(post('news_photographer')), 'news_hastag' => post('news_hastag'), 'news_city' => post('news_city') ? post('news_city') : 'Jakarta', 'photo_slideshow' => '0', 'news_source' => '', 'info_grafis' => '0', 'external_url' => '', 'has_paging' => '0', 'news_tag_activated' => rand(1, 4), 'news_mature' => post('news_mature') ? '1' : '0', 'popular_keyword' => rand(1, 2));
         if (post('news_id')) {
             unset($newsDt['news_id']);
             unset($newsDt['news_entry']);
             unset($newsDt['news_editor']);
             $news_id = post('news_id');
             $this->news_model->updateNews($newsDt, array('news_id' => $news_id));
             //deleting news keyword data
             $this->news_model->deleteRecord('mdk_news_keywords', array('nk_news_id' => $news_id));
             //delete news tag data
             $this->news_model->deleteRecord('mdk_tag_news', array('tag_news_news_id' => $news_id));
         } else {
             $news_id = $this->news_model->saveNewRecord($newsDt, 'mdk_news');
         }
         $this->processNewsTags($news_id, post('news_tags'));
         $this->processNewsKeywords($news_id, post('news_keywords'));
         //processing news ilustration upload
         $this->processNewsIlustration($newsDt, $news_id);
         //save to mdk_news_rubric
         $this->saveMdkNewsRubric($newsDt, $news_id);
         //$this->redirect('/'.$this->ctrler.'/edit/&id='.$news_id."&t=".date("s"));
         Output::redirect($this->config['base_url'] . $this->ctrler . '/');
     } else {
         //$this->redirect('/'.$this->ctrler.'/addnews/');
         Output::redirect($this->config['base_url'] . $this->ctrler . '/addnews/');
     }
 }
开发者ID:cyberorca,项目名称:dfp-api,代码行数:30,代码来源:photonews2.php


注:本文中的Output::redirect方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。