This commit is contained in:
43
app/Helpers/url_helper.php
Normal file
43
app/Helpers/url_helper.php
Normal file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
// CI4에서는 BASEPATH 체크 삭제
|
||||
|
||||
function make_query_string($array)
|
||||
{
|
||||
if (!isset($array) || !is_array($array))
|
||||
return '';
|
||||
|
||||
$qs = '';
|
||||
foreach ($array as $key => $value) {
|
||||
if (is_array($value)) {
|
||||
foreach ($value as $value2) {
|
||||
if (empty($qs)) {
|
||||
$qs .= '?';
|
||||
} else {
|
||||
$qs .= '&';
|
||||
}
|
||||
$qs .= $key . '=' . urlencode($value2);
|
||||
}
|
||||
} else {
|
||||
if (empty($qs)) {
|
||||
$qs .= '?';
|
||||
} else {
|
||||
$qs .= '&';
|
||||
}
|
||||
$qs .= $key . '=' . urlencode($value);
|
||||
}
|
||||
}
|
||||
return $qs;
|
||||
}
|
||||
|
||||
// ... 기존 다른 함수들도 그대로 넣어도 됨
|
||||
|
||||
function siteURL()
|
||||
{
|
||||
$protocol = ((!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] != 'off') || $_SERVER['SERVER_PORT'] == 443)
|
||||
? "https://"
|
||||
: "http://";
|
||||
|
||||
$domainName = $_SERVER['HTTP_HOST'] . '/';
|
||||
return $protocol . $domainName;
|
||||
}
|
||||
Reference in New Issue
Block a user