PHP's file_exists() will not work for me?

前端 未结 7 1725
既然无缘
既然无缘 2020-12-01 04:21

For some reason this PHP code below will not work, I can not figure it out.

It is very strange, file_exists does not seem to see that the image does exist, I have c

相关标签:
7条回答
  • 2020-12-01 05:01

    file_exists does only work on the local file system.

    So try this if you’re using localhost:

    $thumb_name = 'images/userphoto/1/2/2/59874a886a0356abc1_thumb9.jpg';
    if (file_exists($_SERVER['DOCUMENT_ROOT'].$thumb_name)) {
        $img_name = SITE_PATH2.$thumb_name;
    } else {
        $img_name = $noimg;
    }
    
    0 讨论(0)
提交回复
热议问题