file_exist函数不起作用

I have a function that checks if the mobile image exists and if does then it will return true. No matter what I do I can't get this function to work properly.

public function mobileImageExist($image)
{
    $file = "images/$image";
    if(file_exists($file))
        return true;

    return false;
}

I have also tried

public function mobileImageExist($image)
{
    $file = dirname(__FILE__)."/images/$image";
    if(file_exists($file))
        return true;

    return false;
}

the $image parameter that is being passed to the function is just the image name. ex: banner_mobile.jpg

Got it working. It ended up being another function that was referencing the mobileImageExist function and causing it to somehow return true whether or not the file existed or not