本文實例講述了php相對當(dāng)前文件include其它文件的方法。分享給大家供大家參考。具體分析如下:
下面的代碼先獲得當(dāng)前文件路徑,然后通過相對路徑包含其它php文件,在實際使用中非常有用
1
2
3
4
5
|
<?php $currentDir = dirname( __FILE__ ); include $currentDir . '/functions.php' ; include $currentDir . '/classes.php' ; ?> |
希望本文所述對大家的php程序設(shè)計有所幫助。