本文整理汇总了PHP中CHttpRequest::getRequestUri方法的典型用法代码示例。如果您正苦于以下问题:PHP CHttpRequest::getRequestUri方法的具体用法?PHP CHttpRequest::getRequestUri怎么用?PHP CHttpRequest::getRequestUri使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CHttpRequest
的用法示例。
在下文中一共展示了CHttpRequest::getRequestUri方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRequestUri
public function getRequestUri()
{
if ($this->_requestUri === null)
$this->_requestUri = DMultilangHelper::processLangInUrl(parent::getRequestUri());
return $this->_requestUri;
}
示例2: parseUrl
/**
* Parses a URL based on this rule.
* @param CUrlManager $manager the URL manager
* @param CHttpRequest $request the request object
* @param string $pathInfo path info part of the URL (URL suffix is already removed based on {@link CUrlManager::urlSuffix})
* @param string $rawPathInfo path info that contains the potential URL suffix
* @return mixed the route that consists of the controller ID and action ID. False if this rule does not apply.
*/
public function parseUrl($manager, $request, $pathInfo, $rawPathInfo)
{
$len = strlen($request->getBaseUrl());
$page = substr($request->getRequestUri(), $len);
// /index.php?p=123
$tr = array();
if (preg_match_all('/<(\\w+):?(.*?)?>/', $this->pattern, $matches)) {
$tokens = array_combine($matches[1], $matches[2]);
foreach ($tokens as $name => $value) {
if ($value === '') {
$value = '[^\\/]+';
}
$tr["<{$name}>"] = "(?P<{$name}>{$value})";
}
}
$this->pattern = str_replace('?', '\\?', $this->pattern);
$p = trim(rtrim($this->pattern, '*'), '/');
$template = preg_replace('/<(\\w+):?.*?>/', '<$1>', $p);
$this->pattern = '/^\\/' . strtr($template, $tr) . '/';
if (preg_match($this->pattern, $page, $matches)) {
foreach ($_GET as $k => $v) {
unset($_GET[$k]);
}
foreach ($tr as $k => $v) {
$key = substr($k, 1, -1);
if (isset($matches[$key])) {
$_GET[$key] = $matches[$key];
}
}
return $this->route;
}
return false;
}
示例3: getRequestUri
public function getRequestUri(){
if($this->_requestUri!==null)return $this->_requestUri;
$this->_requestUri = parent::getRequestUri();
if(!Yii::app()->isWeb){
if(Yii::app()->isAjax){
$this->_requestUri = substr($this->_requestUri,5);
}elseif(Yii::app()->isExt){
$this->_requestUri = substr($this->_requestUri,6);
}
}
return $this->_requestUri;
示例4: defined
define('YGIN_NEED_INSTALL', !file_exists($localConfig));
if (YGIN_NEED_INSTALL) {
defined('YII_DEBUG') or define('YII_DEBUG', true);
defined('YII_TRACE_LEVEL') or define('YII_TRACE_LEVEL', 3);
}
$local = null;
if (!(defined('YGIN_NEED_INSTALL') && YGIN_NEED_INSTALL)) {
if (file_exists($localConfig)) {
$local = (require $localConfig);
}
}
require_once dirname(__FILE__) . '/ygin/yii/YiiBase.php';
$config = array();
$applicationClass = null;
$request = new CHttpRequest();
if (substr($request->getRequestUri(), 0, 6) == "/admin") {
// система управлением
$config = (require dirname(__FILE__) . '/ygin/modules/backend/config/mainConfig.php');
require_once dirname(__FILE__) . '/ygin/modules/backend/components/BackendApplication.php';
$applicationClass = 'BackendApplication';
} else {
if (substr($request->getRequestUri(), 0, 5) == "/yiic") {
if (!defined("YII_DEBUG") || YII_DEBUG == false) {
echo "yiic - bad request. Enable YII_DEBUG.";
} else {
require dirname(__FILE__) . '/ygin/yiic.php';
}
return;
} else {
// приложение по умолчанию
if (defined('YGIN_NEED_INSTALL') && YGIN_NEED_INSTALL) {
示例5: CHttpRequest
<?php
// ЭТОТ ФАЙЛ НЕ ДОЛЖЕН МЕНЯТЬСЯ В ПРОЕКТЕ
$adminUrl = 'admin';
// чтобы в каждом маршруте не прописывыать admin и т.о. найти нужный контроллер
$request = new CHttpRequest();
$_SERVER['HTTP_X_REWRITE_URL'] = str_replace('//', '/', str_replace('/' . $adminUrl . '/', '/', $request->getRequestUri()));
$mainConfig = array('name' => 'Engine macro', 'language' => 'ru', 'sourceLanguage' => 'ru_RU', 'defaultController' => 'ygin', 'homeUrl' => '/' . $adminUrl . '/', 'viewPath' => realpath(dirname(__FILE__) . '/../views/'), 'theme' => 'ygin', 'preload' => array('authManager', 'log', 'yii2Debug'), 'aliases' => array(), 'import' => array('application.models.*', 'application.controllers.*', 'application.widgets.*', 'application.helpers.*'), 'modules' => array('ygin.backend', 'ygin.user', 'ygin.mail', 'ygin.menu', 'ygin.viewGenerator'), 'components' => array('yii2Debug' => array('class' => 'backend.components.Yii2DebugBackend', 'allowedIPs' => array('192.168.0.*', '127.0.0.1'), 'enabled' => YII_DEBUG), 'format' => array('timeFormat' => 'H:i:s', 'dateFormat' => 'd.m.Y', 'datetimeFormat' => 'd.m.Y H:i:s'), 'user' => array('allowAutoLogin' => true, 'class' => 'user.components.DaWebUser', 'loginUrl' => array('user/user/login')), 'domain' => array('class' => 'ygin.components.DaDomain'), 'authManager' => array('class' => 'ygin.modules.user.components.DaDbAuthManager', 'connectionID' => 'db', 'itemTable' => 'da_auth_item', 'itemChildTable' => 'da_auth_item_child', 'assignmentTable' => 'da_auth_assignment', 'defaultRoles' => array('guest')), 'widgetFactory' => array('class' => 'CWidgetFactory', 'widgets' => array('BreadcrumbsWidget' => array('separator' => '', 'tagName' => 'ul', 'htmlOptions' => array('class' => 'breadcrumb'), 'encodeLabel' => false))), 'clientScript' => array('corePackages' => require dirname(__FILE__) . DIRECTORY_SEPARATOR . '../../../config/packages.php', 'class' => 'ygin.ext.ExtendedClientScript.ExtendedClientScript', 'combineCss' => true, 'compressCss' => !YII_DEBUG, 'combineJs' => true, 'compressJs' => false, 'jsMinPath' => 'ygin.ext.ExtendedClientScript.jsmin.JSMin', 'cssMinPath' => 'ygin.ext.ExtendedClientScript.cssmin.cssmin', 'autoRefresh' => YII_DEBUG), 'urlManager' => array('baseUrl' => '/' . $adminUrl, 'class' => 'backend.components.BackendUrlManager', 'urlFormat' => 'path', 'showScriptName' => false, 'urlSuffix' => '/', 'caseSensitive' => true, 'rules' => array('<controller:\\w+>/<id:\\d+>' => '<controller>/view', '<controller:\\w+>' => '<controller>/index', '<controller:\\w+>/<action:\\w+>/<id:\\d+>' => '<controller>/<action>', '<controller:\\w+>/<action:\\w+>' => '<controller>/<action>')), 'errorHandler' => array('errorAction' => 'static/error'), 'cache' => array('class' => 'system.caching.CDummyCache'), 'log' => array('class' => 'CLogRouter', 'routes' => array('DbProfileLogRoute' => array('class' => 'ygin.ext.db_profiler.DbProfileLogRoute', 'countLimit' => 2, 'slowQueryMin' => 0.2, 'enabled' => false), 'CSSlowLogRoute' => array('class' => 'ygin.ext.CSSlowLogRoute', 'logSlow' => 0.2, 'logFrequent' => 2, 'logFile' => 'query_slow.log'), 'backend' => array('class' => 'DaFileLogRoute', 'levels' => 'info', 'logFile' => 'backend.log', 'categories' => 'backend.*', 'enabled' => true), 'sql_update' => array('class' => 'ygin.components.SqlLogRoute', 'logOnlyQuery' => true, 'includedQueries' => array('~INSERT~', '~CREATE~', '~RENAME~', '~ALTER~', '~UPDATE~', '~TRUNCATE~', '~DELETE~', '~DROP~'), 'excludedQueries' => array('~SHOW CREATE TABLE~', '~^SELECT~'), 'logFile' => 'sql_update.log', 'enabled' => true), 'YiiDebugToolbarRoute' => array('class' => 'backend.components.YiiDebugToolbarRouteBackend', 'ipFilters' => array('192.168.0.*', '127.0.0.1'), 'enabled' => false)))));
$coreConfig = (require dirname(__FILE__) . '/../../../config/core.php');
$backendConfig = dirname(__FILE__) . '/../../../../protected/config/';
$projectConfig = array();
if (file_exists($backendConfig . 'backend.php')) {
$projectConfig = (require $backendConfig . 'backend.php');
} else {
$projectConfig = (require $backendConfig . 'project.php');
unset($projectConfig['theme']);
}
$pluginsConfig = array();
if (file_exists(dirname(__FILE__) . '/../../../../protected/runtime/plugin-compile.dat')) {
$pluginsConfig = unserialize(file_get_contents(dirname(__FILE__) . '/../../../../protected/runtime/plugin-compile.dat'));
}
// опция, включаяющая дополнительные возможности по управлению полями для разработчиков самой системы ygin
defined('YGIN_DEVELOP') or define('YGIN_DEVELOP', false);
return CMap::mergeArray($coreConfig, $mainConfig, $projectConfig, $pluginsConfig);
示例6: getRequestUri
public function getRequestUri()
{
return parent::getRequestUri();
}
示例7: getRequestUri
/**
* @inheritDoc
*/
public function getRequestUri()
{
if ($this->_requestUri === null) {
return parent::getRequestUri();
} else {
return $this->_requestUri;
}
}
示例8: dirname
}
// Переопределяющий конфиг файл на локальном хосте
if (!isset($local)) {
$localConfig = dirname(__FILE__) . '/../protected/config/local.php';
$local = null;
if (file_exists($localConfig)) {
$local = (require $localConfig);
}
}
$config = (require dirname(__FILE__) . '/config/console.php');
if ($local != null) {
$config = CMap::mergeArray($config, $local);
}
if (!in_array(PHP_SAPI, array('cli', 'cgi', 'cgi-fcgi'))) {
$request = new CHttpRequest();
$arr = explode('/', substr($request->getRequestUri(), 1));
$_SERVER['argv'] = array();
foreach ($arr as $k => $v) {
if (trim($v) == '') {
continue;
}
$_SERVER['argv'][$k] = str_replace('%20', ' ', $v);
}
}
if (!isset($_SERVER['SCRIPT_FILENAME'])) {
$_SERVER['SCRIPT_FILENAME'] = __FILE__;
}
//require_once(dirname(__FILE__).'/yii/yiic.php');
// yiic.php from framework
// fix for fcgi
defined('STDIN') or define('STDIN', fopen('php://stdin', 'r'));