本文整理汇总了PHP中URI::uri方法的典型用法代码示例。如果您正苦于以下问题:PHP URI::uri方法的具体用法?PHP URI::uri怎么用?PHP URI::uri使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类URI
的用法示例。
在下文中一共展示了URI::uri方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: strip_one_time_params
/**
* remove the one time GET parameters from further URIs
*
* @param array $keys one time parameters
*/
public static function strip_one_time_params(array $keys) {
foreach ( $keys as $key ) {
if (isset(self::$query[$key])) unset(self::$query[$key]);
}
// if all elements are unset, the array behaves not as an array anymore
if (!count(self::$query)) self::$query = array();
self::$uri = self::build(self::$query);
}
示例2: current
public static function current()
{
if (!is_null(self::$uri)) {
return self::$uri;
}
$uri = trim(Request::pathInfo(), "/");
$uri = $uri ? $uri : "/";
self::$uri = $uri;
$segments = array_diff(explode("/", trim($uri, "/")), array(""));
if (array_get($segments, 0) == "manager") {
self::$isManager = true;
array_shift($segments);
}
self::$segments = $segments;
return $uri;
}
示例3: testToLanguageMethodGeneratesURLsToDifferentLanguage
/**
* Test the URL::to_language method.
*
* @group laravel
*/
public function testToLanguageMethodGeneratesURLsToDifferentLanguage()
{
URI::$uri = 'foo/bar';
Config::set('application.languages', array('sp', 'fr'));
Config::set('application.language', 'sp');
$this->assertEquals('http://localhost/index.php/fr/foo/bar', URL::to_language('fr'));
$this->assertEquals('http://localhost/index.php/fr/', URL::to_language('fr', true));
Config::set('application.index', '');
$this->assertEquals('http://localhost/fr/foo/bar', URL::to_language('fr'));
$this->assertEquals('http://localhost/sp/foo/bar', URL::to_language('en'));
}
示例4: trim
| If the URI starts with one of the supported languages, we will set
| the default lagnauge to match that URI segment and shorten the
| URI we'll pass to the router to not include the lang segment.
|
*/
foreach ($languages as $language) {
if (starts_with($uri, $language)) {
Config::set('application.language', $language);
$uri = trim(substr($uri, strlen($language)), '/');
break;
}
}
if ($uri == '') {
$uri = '/';
}
URI::$uri = $uri;
/*
|--------------------------------------------------------------------------
| Route The Incoming Request
|--------------------------------------------------------------------------
|
| Phew! We can finally route the request to the appropriate route and
| execute the route to get the response. This will give an instance
| of the Response object that we can send back to the browser
|
*/
Request::$route = Routing\Router::route(Request::method(), $uri);
$response = Request::$route->call();
/*
|--------------------------------------------------------------------------
| "Render" The Response
示例5: tearDown
/**
* Destroy the test environment.
*/
public function tearDown()
{
$_SERVER = array();
URI::$uri = null;
URI::$segments = array();
}