如何加载 PEAR 包 [英] How to load a PEAR package

查看:103
本文介绍了如何加载 PEAR 包的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我刚刚安装了一个 PEAR 包 (Event_Dispatcher),但我无法使用该包中的类.当我运行命令 pear list 时,我看到了新包,但是我看到包中的类保存在 /usr/lib/php(我有一台 Mac).

I've just installed a PEAR package (Event_Dispatcher) and I can't use the classes in that package. When I run the command pear list I see the new package, however I see that the classes in the package are saved in /usr/lib/php (I have a Mac).

安装PEAR包后有加载部分吗?如何将文件移动到正确的位置?我可以简单地将文件夹剪切并粘贴到 pear 根文件夹吗?

Is there a loading part after installing a PEAR package? How exactly do I move the files to the right place? Can I simply cut and paste the folder to the pear root folder?

谢谢!

推荐答案

大多数 PEAR 包必须通过通常的 include()require() 函数来包含.它们不是预编译的二进制文件,就像(比如说)MySQL 驱动程序 (mysql.so/mysql.dll) 一样.只要/usr/lib/php 在你的include_path 中,PHP 应该能够在你执行include('nameofpackage.php') 时自动加载包.

Most PEAR packages have to be included via the usual include() and require() functions. They're not precompiled binaries, like (say) the MySQL driver (mysql.so/mysql.dll) are. As long as /usr/lib/php is in your include_path, PHP should be able to load up the package automatically when you do include('nameofpackage.php').

这篇关于如何加载 PEAR 包的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆