如果我完成驱动器号码会怎么样?这只是好奇心,但我有很多字母,当我连接所有东西时,我会在20左右浮动
我需要实现函数来检查路径和URL是相对的,绝对的还是无效的(语法上无效 - 不管资源是否存在).我应该寻找的案件范围是什么?
function check_path($dirOrFile) {
// If it's an absolute path: (Anything that starts with a '/'?)
return 'absolute';
// If it's a relative path:
return 'relative';
// If it's an invalid path:
return 'invalid';
}
function check_url($url) {
// If it's an absolute url: (Anything that starts with a 'http://' or 'https://'?)
return 'absolute';
// If it's a relative url:
return 'relative';
// If it's an invalid url:
return 'invalid';
}
Run Code Online (Sandbox Code Playgroud)