Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
In the previous article, we introduced the concept of pear, coding rules, simple use method, you may have a preliminary understanding of it. This time, we'll introduce the functionality and usage of some of the modules in the existing Pear library.
First, naming convention
Before we get to the existing Pear module, let's take a look at how Pear organizes its classification and naming conventions. The modules in pear are organized in the same way as CPAN, and each module's related files are placed under its own category directory, and some are placed directly under the root directory of pear (a single file). Because Pear does not have a namespace like Java, so your class name should be able to reflect the relationship between your module name or the parent class name, keep a certain agreement, for example, your module name: "Mp3/common", then, your PHP file should be located in: mp3/common.php, The class name of your module should be: Mp3_common. In general, if your module is based on an existing module, it is recommended to put your existing module under the same directory. If you are designing a new class and module, you can create a new directory yourself, or put it under the same directory for similar purposes. For example, you have a new module for processing logs, it is recommended that you put it under the log/, the application module for log processing, if the new module is used to deal with MP3, then you can create a new directory MP3, placed under the MP3 directory.
Two, existing pear module
Since most of pear's modules are still under development, here is a list of the modules in pear that are published along with php4.05, and it should be noted that some abstract classes or base classes (such as mail.php,log.php,cache.php) are not enumerated. We're just focusing on modules that have specific functions. Here is a list of these modules:
Benchmark/timer Test your PHP code for operational efficiency
Benchmark/benchmark_iterate test the performance of a function when you loop through it
Cache/output can cache the output of your PHP script, you can cache it in a variety of ways (there are files, databases, or shared memory), if you use this module to increase the load on the server, so if you want to use the cache of dynamic scripts to provide efficiency, you might as well be using Zend Optimize, this module may not be suitable for
Cache/graphics can cache pictures that you need to dynamically output
Console/getopt the processing module of command line arguments
CMD a virtual shell that can be used to run some system commands
CRYPT/CBC implementation of Perl CRYPT::CBC module simulation
Crypt/hcemd5 to implement Perl CRYPT::HCE_MD5 module functions
DATE/CALC implementation date-related operations
The conversion of Date/human Human calendar
DB provides a unified, abstract database operation layer with back-end support for multiple databases
File/find File Lookup
FILE/PASSWD manipulate password classes of files, such as Password,httppass,cvspassword
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
and provide relevant evidence. A staff member will contact you within 5 working days.