Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
syncEnrollments
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Yeray Santana Hualde
syncEnrollments
Commits
b7b80d6d
Commit
b7b80d6d
authored
Nov 29, 2011
by
Taylor Otwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
the application url will now be auto-detected.
parent
0897bb43
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
31 additions
and
2 deletions
+31
-2
application.php
application/config/application.php
+1
-1
uri.php
laravel/uri.php
+1
-1
url.php
laravel/url.php
+29
-0
No files found.
application/config/application.php
View file @
b7b80d6d
...
...
@@ -11,7 +11,7 @@ return array(
|
*/
'url'
=>
'
http://localhost
'
,
'url'
=>
''
,
/*
|--------------------------------------------------------------------------
...
...
laravel/uri.php
View file @
b7b80d6d
...
...
@@ -34,7 +34,7 @@ class URI {
// Remove the root application URL from the request URI. If the application
// is nested within a sub-directory of the web document root, this will get
// rid of all of the the sub-directories from the request URI.
$uri
=
static
::
remove
(
$uri
,
parse_url
(
Config
::
$items
[
'application'
][
'url'
]
,
PHP_URL_PATH
));
$uri
=
static
::
remove
(
$uri
,
parse_url
(
URL
::
base
()
,
PHP_URL_PATH
));
if
((
$index
=
'/'
.
Config
::
$items
[
'application'
][
'index'
])
!==
'/'
)
{
...
...
laravel/url.php
View file @
b7b80d6d
...
...
@@ -2,6 +2,35 @@
class
URL
{
/**
* Get the base URL of the application.
*
* If the application URL is set in the application configuration file, that
* URL will be returned. Otherwise, the URL will be guessed based on the
* server variables available to the script in the $_SERVER array.
*
* @return string
*/
public
static
function
base
()
{
if
((
$base
=
Config
::
$items
[
'application'
][
'url'
])
!==
''
)
return
$base
;
if
(
isset
(
$_SERVER
[
'HTTP_HOST'
]))
{
$protocol
=
(
Request
::
secure
())
?
'https://'
:
'http://'
;
// By removing the basename of the script, we should be left with the path
// in which the framework is installed. For example, if the framework is
// installed to http://localhost/laravel/public, the path we'll get from
// from this statement will be "/laravel/public".
$path
=
str_replace
(
basename
(
$_SERVER
[
'SCRIPT_NAME'
]),
''
,
$_SERVER
[
'SCRIPT_NAME'
]);
return
rtrim
(
$protocol
.
$_SERVER
[
'HTTP_HOST'
]
.
$path
,
'/'
);
}
return
'http://localhost'
;
}
/**
* Generate an application URL.
*
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment