Home>Article>Backend Development> How to display pictures in php?

How to display pictures in php?

青灯夜游
青灯夜游 Original
2019-05-11 15:32:29 30490browse

How to display pictures in php? The following article will introduce to you two methods of inserting images using PHP. I hope it will be helpful to you.

How to display pictures in php?

Two methods to display images in PHP:

1. Use PHP’s file_get_contents() function

The file_get_contents() function reads the entire file into a string.

Example:

Output:

How to display pictures in php?

2. Use echo img tag

Using PHP to insert pictures actually outputs HTML code.

Example:

"; ?>

Output:

How to display pictures in php?

The above is the detailed content of How to display pictures in php?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn