php ini include,php.ini文件中的include_path设置
include_path的作用就是設置用include()函數(shù)包函文件時的路徑,當然也可以不設置include_path,只要在包函文件時寫出具體的文件相對或絕對路即可:
下面以安裝smarty為例:
下面內容中,我們都是假設你的文件放在了D:\Appserv\www.phpernote.com\Smarty下。
1、找到你的php.ini配置文件,修改php.ini的include_path選項,把smarty的庫文件路徑加上,比如:
include_path = "D:\Appserv\www.phpernote.com\Smarty\libs"
注意:這里可以設置多個包含文件路徑,用";"隔開。
2、載入Smarty庫
在任意項目的代碼中就可以直接使用 include "Smarty.class.php"; 了。
可以看出設置了include_path后,要包函文件Smarty.class.php就比較簡便了,不用寫一大串的路徑。
有兩種方法來設置php的include_path
一:修改php.ini文件中的include_path項。
例:include_path = .:/usr/local/lib/php:./include
二:使用ini_set方法(對于無法修改php.ini的情況)。
例:ini_set("include_path", ".:../:./include:../include");
總結
以上是生活随笔為你收集整理的php ini include,php.ini文件中的include_path设置的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: php中round函数能给整数用吗,PH
- 下一篇: nginx php7 fastcgi,W