我如何创建一个";如果;语句来计算PHP中的前7个字符?
我正在尝试用php编写以下内容:我如何创建一个";如果;语句来计算PHP中的前7个字符?,php,substr,Php,Substr,我正在尝试用php编写以下内容: if ($image starts with "photos/") { echo "the image path starts with photos/"; } 谢谢洛根·塞曼。这个答案很好,但我认为这段代码也有好处,substr(stringstr,intstart,[intlength])@Andi。。。考虑在使用substr时查看更多可用选项。 if (substr($image, 0, 7) == 'photos/')
if ($image starts with "photos/") {
echo "the image path starts with photos/";
}
谢谢洛根·塞曼。这个答案很好,但我认为这段代码也有好处,
substr(stringstr,intstart,[intlength])代码>@Andi。。。考虑在使用substr时查看更多可用选项。
if (substr($image, 0, 7) == 'photos/')