如何创建“if”语句来评估PHP中的前7个字符?

时间:2011-12-03 07:41:39

标签: php substr

我正在尝试用php编写这个:

if ($image starts with "photos/") {
echo "the image path starts with photos/";
}

1 个答案:

答案 0 :(得分:12)

if (substr($image, 0, 7) == 'photos/')