endsWith方法不存在
q326066766 opened this issue · comments
q326066766 commented
endsWith方法不存在
TommyLemon commented
应该是 ThinkPHP 里的,你确定依赖了 ThinkPHP ?
qq547057827 commented
可以不依赖 endwith可以自己写一个
…------------------ 原始邮件 ------------------
发件人: "TommyLemon"<notifications@github.com>;
发送时间: 2019年6月6日(星期四) 下午3:20
收件人: "qq547057827/apijson-php"<apijson-php@noreply.github.com>;
抄送: "Subscribed"<subscribed@noreply.github.com>;
主题: Re: [qq547057827/apijson-php] endsWith方法不存在 (#2)
应该是 ThinkPHP 里的,你确定依赖了 ThinkPHP ?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
bada commented
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 commented
@ulikestyle 非常感谢,如果把代码 提交 Pull Request,你也会被加入这个项目的 贡献者名单 哦.
具体步骤可以参考
https://www.zhihu.com/question/21682976/answer/79489643