문제

I have this image "Трислоен-паркет.png" and this to check if it exists:

$imgs='../images/pc/'.clear_string($categoryrow[1],$tr).'.png';        
if(file_exists($imgs)){ echo 'yes';
}else echo 'no';    

It always returns NO. The strange thing is that if I call the image without check if it is exists - it shows the image but I need to DO check and show that image if exists, otherwise I will show default image..but file_exists does wrong ..

clear_string function only removes white spaces and commas and some other type letters.. how to avoid it?

도움이 되었습니까?

해결책

You can use iconv to set the language format you pass to the functions such as file_exists.

Your code might look something like this:

file_exists(iconv('iso-8859-5', 'utf-8', $imgs));

다른 팁

The problem was that file_exists checks starting from root and in this case the path was wrong.. no encoding was needed.. Sorry guys for taking your time and thanks for your answers !..

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top