Dragon
主机之家测评主机之家测评  2019-11-11 21:02 主机之家测评 隐藏边栏 |   抢沙发  3 
文章评分 0 次,平均分 0.0

如果想判断一个字符串是否以指定的字符(串),在 java 或者 python 中可以用 startwith 函数,但是 php 并没有标准的 startwith 函数,因此如果我们需要在 php 中判断字符串是否以指定字符(串)开头就需要自行实现,具体代码如下:

  function startwith($str,$pattern) {      return (strpos($str,$pattern) === 0 ? true:false;  }  startwith("02405.com","02405") //true

 

本文为原创文章,版权归所有,欢迎分享本文,转载请保留出处!

发表评论

扫一扫二维码分享