當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Request::createFromGlobals方法代碼示例

本文整理匯總了PHP中Thelia\Core\HttpFoundation\Request::createFromGlobals方法的典型用法代碼示例。如果您正苦於以下問題:PHP Request::createFromGlobals方法的具體用法?PHP Request::createFromGlobals怎麽用?PHP Request::createFromGlobals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Thelia\Core\HttpFoundation\Request的用法示例。


在下文中一共展示了Request::createFromGlobals方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: array

<?php

/*************************************************************************************/
/*      This file is part of the Thelia package.                                     */
/*                                                                                   */
/*      Copyright (c) OpenStudio                                                     */
/*      email : dev@thelia.net                                                       */
/*      web : http://www.thelia.net                                                  */
/*                                                                                   */
/*      For the full copyright and license information, please view the LICENSE.txt  */
/*      file that was distributed with this source code.                             */
/*************************************************************************************/
use Thelia\Core\Thelia;
use Thelia\Core\HttpFoundation\Response;
use Thelia\Core\HttpFoundation\Request;
use Thelia\Core\HttpKernel\HttpCache\HttpCache;
//use Symfony\Component\DependencyInjection;
$env = 'dev';
require __DIR__ . '/../core/vendor/autoload.php';
// List of allowed IP
$trustedIp = array('::1', '127.0.0.1');
$request = Request::createFromGlobals();
$thelia = new Thelia("dev", true);
if (false === in_array($request->getClientIp(), $trustedIp)) {
    $response = Response::create('Forbidden', 403)->send();
    $thelia->terminate($request, $response);
} else {
    $response = $thelia->handle($request)->prepare($request)->send();
    $thelia->terminate($request, $response);
}
開發者ID:margery,項目名稱:thelia,代碼行數:30,代碼來源:index_dev.php

示例2:

        \Thelia\Model\ConfigQuery::create()->filterByName('store_notification_emails')->update(array('Value' => $_POST['store_email']));
        \Thelia\Model\ConfigQuery::create()->filterByName('store_name')->update(array('Value' => $_POST['store_name']));
        \Thelia\Model\ConfigQuery::create()->filterByName('url_site')->update(array('Value' => $_POST['url_site']));
        $lang = \Thelia\Model\LangQuery::create()->findOneByLocale(empty($_POST['shop_locale']) ? "en_US" : $_POST['shop_locale']);
        if (null !== $lang) {
            $lang->toggleDefault();
        }
        $secret = \Thelia\Tools\TokenProvider::generateToken();
        \Thelia\Model\ConfigQuery::write('form.secret', $secret, 0, 0);
    }
    //clean up cache directories
    $fs = new \Symfony\Component\Filesystem\Filesystem();
    $fs->remove(THELIA_ROOT . '/cache/prod');
    $fs->remove(THELIA_ROOT . '/cache/dev');
    $fs->remove(THELIA_ROOT . '/cache/install');
    $request = \Thelia\Core\HttpFoundation\Request::createFromGlobals();
    $_SESSION['install']['step'] = $step;
    // Retrieve the website url
    $url = $_SERVER['PHP_SELF'];
    $website_url = preg_replace("#/install/[a-z](.*)#", '', $url);
    ?>
    <div class="well">
        <p class="lead text-center">
            <?php 
    echo $trans->trans('Thelia is now installed. Thank you !');
    ?>
        </p>

<?php 
    $scriptHook = <<<SCRIPT
<script>
開發者ID:GuiminZHOU,項目名稱:thelia,代碼行數:31,代碼來源:end.php


注:本文中的Thelia\Core\HttpFoundation\Request::createFromGlobals方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。