Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

endsWith方法不存在 #2

Open
q326066766 opened this issue May 11, 2019 · 4 comments
Open

endsWith方法不存在 #2

q326066766 opened this issue May 11, 2019 · 4 comments

Comments

@q326066766
Copy link

endsWith方法不存在

@TommyLemon
Copy link
Contributor

应该是 ThinkPHP 里的,你确定依赖了 ThinkPHP ?

@qq547057827
Copy link
Owner

qq547057827 commented Jun 9, 2019 via email

@ulikestyle
Copy link

startsWith和endsWith方法提供

if(!function_exists('startsWith')){
    function startsWith($haystack, $needle)
    {
        $length = strlen($needle);
        return (substr($haystack, 0, $length) === $needle);
    }
}


if(!function_exists('endsWith')){
    function endsWith($haystack, $needle)
    {
        $length = strlen($needle);

        return $length === 0 ||
            (substr($haystack, -$length) === $needle);
    }
}

@TommyLemon
Copy link
Contributor

@ulikestyle 非常感谢,如果把代码 提交 Pull Request,你也会被加入这个项目的 贡献者名单 哦.
具体步骤可以参考
https://www.zhihu.com/question/21682976/answer/79489643

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants