找不到这个功能.我假设我需要使用正则表达式?
在网址包含至少1个大写字母的情况下,我正在尝试在php中执行html重定向.
例如:http: //www.domain.com/Michael_Jordan需要重定向到http://www.domain.com/michael_jordan - 唯一的问题是我似乎无法找到一个脚本来检测是否至少有1个大写字母存在.
Rag*_*geZ 38
一些正则表达式应该能够工作,你可以使用preg_match和[A-Z]
if(preg_match('/[A-Z]/', $domain)){
// There is one upper
}
Run Code Online (Sandbox Code Playgroud)
Tyl*_*ves 30
if (strtolower($url) != $url){
//etc...
Run Code Online (Sandbox Code Playgroud)
你也可以试试这个
if (!ctype_lower($string)) {
// there is at least une uppercase character
}
Run Code Online (Sandbox Code Playgroud)
不确定这是否比提出的其他两种方法更有效。
| 归档时间: |
|
| 查看次数: |
30370 次 |
| 最近记录: |