PHP 5.0 Pear的安装方法实例讲解
欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入 安装pear pear是PHP的扩展和应用程序库,包含了很多有用的类,安装好php5.0后,pear实际上并没有被安装,安装的方法如下: 1.在php目录中双击go-pear.bat. 2.按照提示输入一些设置信息,主要是要把局
欢迎进入Linux社区论坛,与200万技术人员互动交流 >>进入
安装pear
pear是PHP的扩展和应用程序库,包含了很多有用的类,安装好php5.0后,pear实际上并没有被安装,安装的方法如下:
1.在php目录中双击go-pear.bat.
2.按照提示输入一些设置信息,主要是要把局域网的网关加上,如http://192.168.0.1:80/ ,pear要用这个地址访问Internet,若无代理服务器则直接回车
3.然后会提示一些包和PHP绑定,选择Y .
4.然后安装基本包和提示安装成功,就这么简单。
5.打开windows目录下的php.ini文件,然后查找到如下的地方:
; UNIX: "/path1:/path2"
;include_path = ".:/php/includes"
;
; Windows: "\path1;\path2"
;include_path = ".;c:\php\includes"
把最后一行的注释去掉,然后把后面路径改成你的PEAR路径,例如:
include_path = ".;c:\php\pear\"
保存PHP.INI,然后重新启动APACHE即可。
pear命令帮助
在你的PHP根目录中可以找到PEAR.bat文件,这是管理pear的命令,在CMD中使用,要设置环境变量PATH,或双击生成的EV_XXX.REG文件。它的部分命令功能如下:
安装:
自网路安装某一个pear程式库:
pear install packagename
下载 packages 但不安装:
pear download packagename
pear download-all
安装已下载的package:
pear install filename.tgz
列表:
目前pear网站上所有可取得pear程式库列表:
pear remote-list
列出已安装package:
pear list
列出可以升级的package:
pear list-upgrades
更新(升级):
更新package:
pear upgrade packagename
pear upgrade-all
移除:
删除已安装的package:
pear uninstall packagename
安装新的包
比如你下载了新的包xxx.tgz.
把它拷到C:\PHP\PEAR\go-pear-bundle目录,然后在CMD中输入:
pear install xxx.tgz
就行了,相关文件解压到了C:\PHP\PEAR\对应的目录中。
实例
下载PEAR::HTML_Common 和 PEAR::HTML_QuickForm包,然后安装。
建个新的PHP文件,输入代码
require_once("HTML\QuickForm.php");
//建立一个表单对象
$form = new HTML_QuickForm('frmTest', 'post');
$form->addElement('header', 'header', '请登录');
$form->addElement('text', 'name', '用户名:');
$form->addElement('password', 'password', '密码:');
$form->addElement('submit', 'submit', '提交');
// 输出到浏览器
$form->display();
?>
在浏览器中看看结果吧,是不是比你手动写代码快的多!

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

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

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

Hot Topics



In this chapter, we will understand the Environment Variables, General Configuration, Database Configuration and Email Configuration in CakePHP.

PHP 8.4 brings several new features, security improvements, and performance improvements with healthy amounts of feature deprecations and removals. This guide explains how to install PHP 8.4 or upgrade to PHP 8.4 on Ubuntu, Debian, or their derivati

To work with date and time in cakephp4, we are going to make use of the available FrozenTime class.

To work on file upload we are going to use the form helper. Here, is an example for file upload.

In this chapter, we are going to learn the following topics related to routing ?

Working with database in CakePHP is very easy. We will understand the CRUD (Create, Read, Update, Delete) operations in this chapter.

CakePHP is an open-source framework for PHP. It is intended to make developing, deploying and maintaining applications much easier. CakePHP is based on a MVC-like architecture that is both powerful and easy to grasp. Models, Views, and Controllers gu

Validator can be created by adding the following two lines in the controller.
