我怎样才能检查php中字符串的开头?
发布时间:2020-12-13 22:20:18 所属栏目:PHP教程 来源:网络整理
导读:参见英文答案 How to add http:// if it doesn’t exists in the URL?????????????????????????????????????8个 我想要这样的东西 用户输入网站链接 如果链接,我需要检查链接 不是以我想要的’http://’开头 将“http://”附加到链接. 我怎么能用PHP做到这
参见英文答案 >
How to add http:// if it doesn’t exists in the URL?????????????????????????????????????8个
我想要这样的东西 >用户输入网站链接 我怎么能用PHP做到这一点? 解决方法if (stripos($url,'http://') !== 0) { $url = 'http://' . $url; } (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |