0
我正在用php include添加絕對路徑。如何用php添加絕對路徑包括
$ path =「/」;
instead of include('../connect.php');
i want to include like include($path.'connect.php');
我正在用php include添加絕對路徑。如何用php添加絕對路徑包括
$ path =「/」;
instead of include('../connect.php');
i want to include like include($path.'connect.php');
如果您使用任何框架,然後按照,否則,你可以做如下:
$path = __DIR__;
include($path . '/connect.php'); // change this to match path
我使用的東西simular那麼。我使用鏈接的p值來獲取我的頁面。 我拿出你也在這裏引用的片段
$pages_dir = 'inc/content';
include($pages_dir.'/'.$p.'.inc.php');
什麼是阻止你? –
可能的重複http://stackoverflow.com/questions/344823/how-do-i-format-a-php-include-absolute-rather-than-relative-path – Marcus