In PHP, you can use the file_exists() function to determine whether a picture exists. This function can detect whether a file or directory exists. The syntax format is "file_exists(lujing)"; if the picture file exists, it returns true. , otherwise return false.
The operating environment of this tutorial: windows7 system, PHP7.1 version, DELL G3 computer
In PHP, you can use the file_exists() function To determine whether the image exists.
<?php header("Content-type:text/html;charset=utf-8"); $file = 'img.png'; if(file_exists($file)){ echo "图片文件 {$file} 存在!"; }else{ echo "图片文件 {$file} 不存在!"; } ?>
Output result:
Let’s take a brief look at the file_exists() function:
file_exists() function checks whether the file or directory is exist. Returns true if the specified file or directory exists, false otherwise.
Syntax: file_exists(path)
Parameter description is as follows:
path: required. Specifies the path to be checked.
Recommended study: "PHP Video Tutorial"
The above is the detailed content of How to determine whether the image exists in php. For more information, please follow other related articles on the PHP Chinese website!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

WebStorm Mac version
Useful JavaScript development tools

SublimeText3 Linux new version
SublimeText3 Linux latest version

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Atom editor mac version download
The most popular open source editor

Dreamweaver CS6
Visual web development tools
