-------------- Install PEAR -------------- PEAR is PHP extension and application library, containing a lot of useful classes, installing PHP5 After .0, PEAR actually is not installed, the method is installed as follows:
1. Double-click Go-pear.bat in the PHP directory. 2. Follow the prompts to enter some setup information, mainly to add the gateway of the LAN, such as http://192.168.0.1:80/, PEAR wants to access the Internet with this address, if there is no proxy server, enter, I It is directly pressing it. 3. will then prompt some packets and PHP bindings to select Y. 4. Then install the basic package and prompt installation is so simple. 5. Open the php.ini file under the Windows directory, then find the following place:; UNIX: "/ Path1: / Path2"; include_path = ".: / Php / incruDes" ;; Windows: "/ Path1; / Path2 "; incrude_path =".; c: / php / incrudes "
Remove the last line of comments, then change the back path to your PEAR path, for example: include_path = ".; C: / PHP / PEAR /" Save PHP.ini and then restart Apache.
--------------- Pear command help --------------- In your php root directory, you can find the pear.bat file, which is management PEAR command, use in CMD, set the environment variable path, or double-click the generated EV_XXX.REG file. Its partial command function is as follows:
installation:
Install a PEAR program library from the Internet: Pear Install PackageName
Download packages but don't install: Pear Download PackageName Pear Download-All
Install Downloaded: Pear Install FileName.tgz
List:
All Pear Remote-List is currently available on the PEAR website: Pear Remote-List
List installed package: Pear List
List the package: Pear List-Upgrades that can be upgraded
Update (upgrade):
Update package: Pear Upgrade PackageName Pear Upgrade-All
Remove:
Delete installed packages: Pear Uninstall PackageName
---------------- Install the new package ---------------, for example, from http://pear.php.net/package / Download the new package xxx.tgz. Turn it to the C: / PHP / PEAR / Go-Pear-bundle directory, then enter: pear install xxx.tgz in CMD, the relevant file is extracted into the C: / PHP / PEAR / corresponding directory. -------------- - Example --------------- Download Pear :: HTML_COMMON and PEAR :: HTML_QUICKFORM package, then install. Built a new PHP file, enter the code
$ form-> addelement ('header', 'header', 'please login'); $ form-> addelement ('text', 'name ",' username: '); $ form-> addelement (' password ' , 'password', 'password:'); $ form-> addelement ('Submit', 'Submit', '); // Output to Browser $ FORM-> DISPLAY ();> body> Html>
Look at the result in the browser, is it more frequent than you manually write code! =============================================================================================================================================================================================★ Require_once 'mail.php'; flush (); $ conf ['mail'] = array ('host' => 'SMTP.163.com', // SMTP server address, you can use IP addresses or domain 'auth' = > true, // true indicates that the SMTP server needs to be verified, the FALSE code does not require 'username' => mailuser ', // username' password '=>' mailpassword '// password);
/ *** * Use $ headers array, you can define the content of the email header, such as using $ headers ['reply-to'] can define the reply address * In this way, it can be easily customized to send the mail header * ** / $ headers ['from'] = 'mailuser@163.com'; // Sending address $ headers ['to'] = 'TOEAMIL@163.com'; // Receive address $ Headers ['Subject '] =' Test mail send by php '; // message title $ mail_object = & mail :: Factory (' SMTP ', $ conf [' mail ']);
$ body = '<<< msg 2 // message body hello world !!! msg';
$ mail_res = $ mail_object-> send ($ Headers ['To'], $ Headers, $ Body); // Send
IF (Pear :: ISERROR ($ mail_res)) {// detection error DIE ($ mail_res-> getMessage ());} echo 'send finished.' ;?>