Home  >  Article  >  Backend Development  >  Detailed explanation of the two methods of opening the gd library in PHP

Detailed explanation of the two methods of opening the gd library in PHP

醉折花枝作酒筹
醉折花枝作酒筹Original
2021-03-22 16:21:034977browse

This article introduces two methods of opening the PHP GD library under Windows. The GD library is not enabled by default in PHP. If you want it to support image processing functions, you must enable it manually. Friends in need are advised to refer to the methods provided in this article.

Detailed explanation of the two methods of opening the gd library in PHP

Method 1:

When we don’t know where the GD library is at the beginning, we can search it on the computer , type php.ini in the search bar like I did, and then the computer will search for all php.ini files to facilitate our search.

gd库 (2).png

At this time, you can choose according to your own php version. The php I use is 7.3, so I opened the php.ini file with notepad. You can Search for gd inside, find the location of the purple shading line of code, and remove the semicolon before or after this line of code. In this way, we have successfully opened the GD library.

Detailed explanation of the two methods of opening the gd library in PHP

Method 2:

Mine is phpstudy_pro, so I will use phpstudy_pro to demonstrate. Open phpstudy_pro and click on the website on the left. At this time, we click on management to select php extension. You can see that gd2 is checked here, which indicates that the gd library has been opened. If not, we need to click gd2 to open the GD library. Detailed explanation of the two methods of opening the gd library in PHP

We just know that turning it on is not enough, we also need to verify it to prevent our GD library from not being turned on.

First, create a php file, write the following code and save it:

<?php
phpinfo();
?>

Then open the file you just created, pull down, and you will see the following interface, which will indicate that the GD library has been opened .

gd库 (3).png

Recommended: "PHP Video Tutorial"

The above is the detailed content of Detailed explanation of the two methods of opening the gd library 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