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


PHP Slim::redirect方法代码示例

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


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

示例1: Delete

 public function Delete($files, \Slim\Slim &$app, $page)
 {
     $obj = new Files();
     $obj->parseFile($files);
     $user_id = $obj->user_id;
     //$cookieDB = $obj->cookie;
     $cookie = $app->getCookie('username');
     $db = $app->db;
     $logged = new Logged();
     $id = $logged->getLogged($db, $cookie);
     //checking of the user is registered in Users table as the user or anonymous which added this file and getting his id
     if ($id == $user_id) {
         $foo = new Foo();
         $foo->token = $page;
         $mapper = new FooMapper($db);
         $files = $mapper->delete($foo);
         $path = $obj->path;
         $filename = "uploads/" . $path;
         //deleting file from the folder
         unlink($filename);
         $app->redirect('/TwigBlog/');
     } else {
         $app->error();
     }
 }
开发者ID:toppestkek,项目名称:TwigBlog,代码行数:25,代码来源:Checkrights.php

示例2: get

 public function get()
 {
     $cookieName = session_name();
     $sessionParams = session_get_cookie_params();
     // Unset cookie in browser
     setcookie($cookieName, false, 1, $sessionParams['path'], $sessionParams['domain'], $sessionParams['secure']);
     $this->slim->redirect($this->slim->request->getRootUri() . '/login');
 }
开发者ID:etu,项目名称:0bRSS,代码行数:8,代码来源:Logout.php

示例3: post

 public function post()
 {
     // Read JSON from Body-input
     $requestData = json_decode($this->slim->request->getBody());
     // Create feed
     $feedId = $this->feedsDao->create($_SESSION['user']['id'], ['name' => $requestData->name, 'website_uri' => $requestData->website_uri, 'feed_uri' => $requestData->feed_uri, 'update_interval' => $requestData->update_interval]);
     // Redirect to the new API-Resource to tell the client where it is
     $this->slim->redirect($this->slim->request->getRootUri() . '/api/feeds/' . $feedId);
 }
开发者ID:etu,项目名称:0bRSS,代码行数:9,代码来源:Feeds.php

示例4: redirect

 public function redirect($url, $status = 302)
 {
     if (filter_var($url, FILTER_VALIDATE_URL) === false) {
         parent::redirect((Config::get('url_rewrite', true) ? '' : '/index.php') . $url, $status);
     } else {
         parent::redirect($url, $status);
     }
 }
开发者ID:hernandes,项目名称:mithos,代码行数:8,代码来源:Application.php

示例5: redirect

 /**
  * @param $location
  * @param $status
  */
 public function redirect($location, $status = 302)
 {
     try {
         $this->app->redirect($location, $status);
     } catch (\Slim\Exception\Stop $e) {
         // do nothing
     }
 }
开发者ID:stuartmclean,项目名称:my_website,代码行数:12,代码来源:SlimApp.php

示例6: routes

 function routes(\Slim\Slim $app)
 {
     $base = $this->getBasePath();
     $app->get($base . '/', function () use($app) {
         $app->redirect($app->Doc->getBasePath() . '/api-doc/');
     });
     $app->get($base . '/api-doc/json', function () use($app) {
         $app->Doc->json();
     });
     $app->get($base . '/api-doc/', function () use($app) {
         $app->Doc->ui();
     });
     $app->get($base . '/api-doc/json/:name', function ($name) use($app) {
         $app->Doc->api($name);
     });
 }
开发者ID:digitalunited,项目名称:wp-elastic-api,代码行数:16,代码来源:Doc.php

示例7: checkRequirements

 public function checkRequirements()
 {
     $paths = Utils::getPaths(SW_PATH . "/engine/Shopware/Components/Check/Data/Path.xml");
     clearstatcache();
     $systemCheckPathResults = Utils::checkPaths($paths, SW_PATH);
     foreach ($systemCheckPathResults as $value) {
         if (!$value['result']) {
             $fileName = SW_PATH . '/' . $value['name'];
             @mkdir($fileName, 0777, true);
             @chmod($fileName, 0777);
         }
     }
     clearstatcache();
     $systemCheckPathResults = Utils::checkPaths($paths, SW_PATH);
     $hasErrors = false;
     foreach ($systemCheckPathResults as $value) {
         if (!$value['result']) {
             $hasErrors = true;
         }
     }
     $directoriesToDelete = ['engine/Library/Mpdf/tmp' => false, 'engine/Library/Mpdf/ttfontdata' => false];
     CommonUtils::clearOpcodeCache();
     $results = [];
     foreach ($directoriesToDelete as $directory => $deleteDirecory) {
         $result = true;
         $filePath = SW_PATH . '/' . $directory;
         Utils::deleteDir($filePath, $deleteDirecory);
         if ($deleteDirecory && is_dir($filePath)) {
             $result = false;
             $hasErrors = true;
         }
         if ($deleteDirecory) {
             $results[$directory] = $result;
         }
     }
     if (!$hasErrors && $this->app->request()->get("force") !== "1") {
         // No errors, skip page except if force parameter is set
         $this->app->redirect($this->app->urlFor("dbmigration"));
     }
     $isSkippableCheck = $this->app->config('skippable.check');
     if ($isSkippableCheck && $this->app->request()->get("force") !== "1") {
         // No errors, skip page except if force parameter is set
         $this->app->redirect($this->app->urlFor("dbmigration"));
     }
     $this->app->render('checks.php', ['systemCheckResultsWritePermissions' => $systemCheckPathResults, 'filesToDelete' => $results, 'error' => $hasErrors]);
 }
开发者ID:GerDner,项目名称:luck-docker,代码行数:46,代码来源:RequirementsController.php

示例8: redirect

 /**
  * Redirect controller
  *
  * @param string $path
  * @return void
  */
 protected function redirect($path)
 {
     $path = str_replace('//', '/', $this->app->baseURL . $path);
     $this->app->redirect($path);
 }
开发者ID:im286er,项目名称:slimore,代码行数:11,代码来源:Controller.php

示例9: action_logout

 public function action_logout(\Slim\Slim $app)
 {
     $app->user->logout();
     $app->redirect("/");
 }
开发者ID:Covert-Inferno,项目名称:eveATcheck,代码行数:5,代码来源:user.php

示例10: Picture

        if (isset($matches[1])) {
            $format = $matches[1];
        }
        $picture = new Picture($conf, DEFAULT_PICTURE, $app_base_url);
        $display = $picture->getDisplay($format);
        $response = $app->response();
        foreach ($display['headers'] as $key => $header) {
            $response[$key] = $header;
        }
        $response->body($display['content']);
    } else {
        $app->render('50x.html.twig', array('exception' => $e));
    }
});
//main route
$app->get('/', function () use($app, $app_base_url) {
    $app->redirect($app_base_url . '/viewer/' . DEFAULT_PICTURE);
});
//include routes files
require_once 'routes/images.routes.php';
require_once 'routes/series.routes.php';
require_once 'routes/ajax.routes.php';
if (APP_DEBUG === true) {
    include_once 'routes/debug.routes.php';
}
if (!defined('APP_TESTS')) {
    $app->run();
    if (isset($profiler)) {
        $profiler->stop();
    }
}
开发者ID:Anaphore,项目名称:viewer,代码行数:31,代码来源:main.php

示例11: redirect

 public function redirect($name, $params = array(), $routeName = true)
 {
     $url = $routeName ? $this->urlFor($name, $params) : $name;
     parent::redirect($url);
 }
开发者ID:suryakencana,项目名称:tekkadan,代码行数:5,代码来源:Zi.php

示例12: function

$app->group('/', function () use($app) {
    $app->get('/', function () use($app) {
    });
});
$app->group('/login', function () use($app) {
    $app->get('/', function () use($app) {
        $app->render('login.php');
    });
    $app->post('/', function () use($app) {
        $data = $app->request()->post();
        $login = new LoginController();
        $result = $login->login($data);
        if ($result) {
            $app->flash('msgInfo', 'Bienvenido ' . $_SESSION['user']);
            if ($_SESSION['tipo'] == 1) {
                $app->redirect(URL . 'pacientes');
            }
            if ($_SESSION['tipo'] == 2) {
                $app->redirect(URL . 'turnos');
            }
            if ($_SESSION['tipo'] == 3) {
                $app->redirect(URL . 'guardias');
            }
            if ($_SESSION['tipo'] == 4) {
                $app->redirect(URL . 'turnos');
            }
        } else {
            $app->flash('msgError', 'Datos incorrectos.');
            $app->redirect(URL . 'login');
        }
    });
开发者ID:RodrigoBattagliero,项目名称:proyecto-simat,代码行数:31,代码来源:index.php

示例13: redirect

 /**
  * {@inheritDoc}
  */
 public function redirect($url, $status = 302)
 {
     parent::redirect($this->getWebPath() . $url, $status);
 }
开发者ID:bistro,项目名称:swell,代码行数:7,代码来源:App.php

示例14: function

$app->get('/download_report', function () use($app, $config) {
    $fileName = $app->request()->params('filename');
    echo "<pre>";
    echo file_get_contents($config['log_files_path'] . $fileName);
});
$app->get('/process/', function () use($app, $config) {
    $fileName = $app->request()->params('filename');
    $locker = new ProcessLocker($config['lock_file']);
    if (!$locker->isLocked()) {
        $splitter = new CsvSplitter(new CsvFile($fileName), $config['output_csv_path']);
        $splitter->split($config['split_size']);
        $command = $config['nohup_path'] . ' ' . $config['php_path'] . ' ' . __DIR__ . '/src/shell/csv_importer.php ' . $config['output_csv_path'] . '  > /dev/null 2>&1 &';
        $process = new Process($command, $config['proc_working_path']);
        $process->run();
    }
    $app->redirect('/csv_batch_process/index.php');
});
use Helpers\Magento\MageWrapper;
use Repositories\Magento\CatalogRepository;
use Repositories\Magento\EavCatalogProductRepository;
use Processors\Magento\ProductImporter;
$app->get('/test/', function () use($app, $config) {
    ini_set('max_execution_time', -1);
    Mage::app('admin', 'store', array('global_ban_use_cache' => true))->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID);
    $mageWrapper = new MageWrapper(Mage);
    $eavRepository = new EavCatalogProductRepository($mageWrapper);
    $catalogRepository = new CatalogRepository($mageWrapper, $eavRepository);
    $magentoProcessor = new ProductImporter($catalogRepository);
    $magentoProcessor->process(new CsvFile('sample.csv'), 'sample.csv');
});
$app->get('/test_splitter/', function () use($app, $config) {
开发者ID:vinicarlos56,项目名称:csv-batch-processor,代码行数:31,代码来源:index.php

示例15: configureRoutes

 /**
  * Configure routes to be handled by application.
  *
  * @param \Slim\Slim $slim Application
  */
 protected function configureRoutes(\Slim\Slim $slim)
 {
     $middleware = array('must-revalidate' => function () use($slim) {
         $slim->response->headers->set('Cache-Control', 'private, must-revalidate, max-age=0');
         $slim->response->headers->set('Expires', 'Thu, 01 Jan 1970 00:00:00 GMT');
     }, 'inject-user' => function () use($slim) {
         $user = $slim->authManager->getUserData();
         $slim->view->set('user', $user);
     }, 'require-user' => function () use($slim) {
         if ($slim->authManager->isAnonymous()) {
             if ($slim->request->isGet()) {
                 $uri = $slim->request->getUrl() . $slim->request->getPath();
                 $qs = Form::qsMerge();
                 if ($qs) {
                     $uri = "{$uri}?{$qs}";
                 }
                 $_SESSION[AuthManager::NEXTPAGE_SESSION_KEY] = $uri;
             }
             // FIXME: use i18n
             $slim->flash('error', 'Login required');
             $slim->flashKeep();
             $slim->redirect($slim->urlFor('login'));
         }
     });
     $slim->group('/', $middleware['inject-user'], function () use($slim, $middleware) {
         App::redirect($slim, '', 'random', 'home');
         App::redirect($slim, 'index', 'random');
         $slim->get('random', function () use($slim) {
             $page = new Pages\Random($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page();
         })->name('random');
         $slim->get('random.json', function () use($slim) {
             $slim->response->headers->set('Content-Type', 'application/json');
             $page = new Pages\Random($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page->setTemplate('random.json');
             $page();
         })->name('random.json');
         $slim->get('search', function () use($slim) {
             $page = new Pages\Search($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page();
         })->name('search');
         $slim->get('top', function () use($slim) {
             $page = new Pages\Top($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page();
         })->name('top');
         App::template($slim, 'login');
         $slim->get('logout', $middleware['must-revalidate'], function () use($slim) {
             $slim->authManager->logout();
             $slim->redirect($slim->urlFor('home'));
         })->name('logout');
         App::template($slim, 'about');
         App::template($slim, 'help');
     });
     // end group '/'
     $slim->group('/quip/', $middleware['inject-user'], function () use($slim, $middleware) {
         $slim->get(':id', function ($id) use($slim) {
             $page = new Pages\Quip($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page($id);
         })->name('quip');
         $slim->get(':id/edit', $middleware['require-user'], function ($id) use($slim) {
             $page = new Pages\Edit($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page($id);
         })->name('edit');
         $slim->post(':id/post', $middleware['require-user'], function ($id) use($slim) {
             $page = new Pages\Edit($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page($id);
         })->name('edit_post');
         $slim->post(':id/delete', $middleware['require-user'], function ($id) use($slim) {
             $page = new Pages\Delete($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page($id);
         })->name('delete_post');
         $slim->post(':id/vote', $middleware['require-user'], function ($id) use($slim) {
             $page = new Pages\Vote($slim);
             $page->setI18nContext($slim->i18nContext);
             $page->setQuips($slim->quips);
             $page($id);
         })->name('vote_post');
     });
     $slim->group('/oauth/', function () use($slim) {
//.........这里部分代码省略.........
开发者ID:bd808,项目名称:quips,代码行数:101,代码来源:App.php


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