首页 > 解决方案 > 保持大小写不变的问题

问题描述

我使用以下 php 来显示 URL 的任何部分:

<?php
$segments = explode('/', trim(parse_url($_SERVER['REQUEST_URI'],PHP_URL_PATH), '/'));
$numSegments = count($segments); 
$currentSegment1 = $segments[$numSegments - 1];
$currentSegment2 = $segments[$numSegments - 2];
$currentSegment3 = $segments[$numSegments - 3];
$currentSegment4 = $segments[$numSegments - 4];
?>

<?php echo $currentSegment1;?>

问题是它全部转换为小写: http ://example.com/ABCDefgh

它显示 abcdefgh 而不是 ABCDefgh,这是一个问题,因为我使用它来嵌入视频 ID 区分大小写的 youtube 视频。

我的问题:脚本有什么办法可以保持大小写不变?

谢谢!

标签: casecase-sensitive

解决方案


推荐阅读