复制代码 代码如下:<?php /* 判断字符串是否存在的函数 */ function strexists($haystack, $needle) { return !(strpos($haystack, $needle) === FALSE);//注意这里的”===” } /* Test */ $mystring = ‘abc’; $findme = ‘a’; $pos = strpos($mystring, $findme); // Note our use of ===. Simply == would not work as expected // because the positi