本文整理汇总了PHP中wcf\util\StringUtil::isASCII方法的典型用法代码示例。如果您正苦于以下问题:PHP StringUtil::isASCII方法的具体用法?PHP StringUtil::isASCII怎么用?PHP StringUtil::isASCII使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类wcf\util\StringUtil
的用法示例。
在下文中一共展示了StringUtil::isASCII方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getRequestURI
/**
* Returns the request uri of the active request.
*
* @return string
*/
public static function getRequestURI() {
$REQUEST_URI = '';
$appendQueryString = true;
if (!empty($_SERVER['ORIG_PATH_INFO']) && strpos($_SERVER['ORIG_PATH_INFO'], '.php') !== false) {
$REQUEST_URI = $_SERVER['ORIG_PATH_INFO'];
}
else if (!empty($_SERVER['ORIG_SCRIPT_NAME'])) {
$REQUEST_URI = $_SERVER['ORIG_SCRIPT_NAME'];
}
else if (!empty($_SERVER['SCRIPT_NAME']) && (isset($_SERVER['PATH_INFO']) && !empty($_SERVER['PATH_INFO']))) {
$REQUEST_URI = $_SERVER['SCRIPT_NAME'] . $_SERVER['PATH_INFO'];
}
else if (isset($_SERVER['REQUEST_URI']) && !empty($_SERVER['REQUEST_URI'])) {
$REQUEST_URI = $_SERVER['REQUEST_URI'];
$appendQueryString = false;
}
else if (!empty($_SERVER['PHP_SELF'])) {
$REQUEST_URI = $_SERVER['PHP_SELF'];
}
else if (!empty($_SERVER['PATH_INFO'])) {
$REQUEST_URI = $_SERVER['PATH_INFO'];
}
if ($appendQueryString && !empty($_SERVER['QUERY_STRING'])) {
$REQUEST_URI .= '?'.$_SERVER['QUERY_STRING'];
}
// fix encoding
if (!StringUtil::isASCII($REQUEST_URI) && !StringUtil::isUTF8($REQUEST_URI)) {
$REQUEST_URI = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $REQUEST_URI);
}
return StringUtil::substring(FileUtil::unifyDirSeperator($REQUEST_URI), 0, 255);
}
示例2: getRequestURI
/**
* Returns the URI of the current page.
*
* @return string
*/
public static function getRequestURI() {
// resolve path and query components
$scriptName = $_SERVER['SCRIPT_NAME'];
if (empty($_SERVER['PATH_INFO'])) {
// bug fix if URL omits script name and path
$scriptName = substr($scriptName, 0, strrpos($scriptName, '/'));
}
$path = str_replace('/index.php', '', str_replace($scriptName, '', $_SERVER['REQUEST_URI']));
if (!StringUtil::isASCII($path) && !StringUtil::isUTF8($path)) {
$path = StringUtil::convertEncoding('ISO-8859-1', 'UTF-8', $path);
}
$path = FileUtil::removeLeadingSlash($path);
$baseHref = self::getTPL()->get('baseHref');
if (!empty($path) && StringUtil::indexOf($path, '?') !== 0) {
$baseHref .= 'index.php/';
}
return $baseHref . $path;
}