检查字符串是否存在

/**
     * 查看字符是否存在
     * @param $str
     * @param $target
     * @return bool
     */
    public static function checkStrExist($str,$target) {
        $res = strpos($str,$target); // 目标第一次出现的位置,第一位为0 没发现,返回false
        if ($res === false) { // 恒等于false
            return false;
        } else {
            return true;
        }
    }

检查字符串是否存在。

原文地址:https://www.cnblogs.com/jiqing9006/p/11044311.html