Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
最简单的方法是使用子字符串进行比较
if (substr($mystring, 0, 7) === 'http://') { // do something }
当然要记住要取确切的字符数。