0

我正在使用 php 包含添加绝对路径。

$路径="/";

instead of include('../connect.php');

i want to include like include($path.'connect.php');
4

2 回答 2

3

如果您正在使用任何框架,请遵循该框架,否则您可以执行以下操作:

$path = __DIR__;
include($path . '/connect.php'); // change this to match path
于 2012-10-10T07:45:10.573 回答
2

我正在使用类似的东西。我正在使用链接中的 ap 值来获取我的页面。我在这里也提取了您引用的片段

$pages_dir = 'inc/content';
include($pages_dir.'/'.$p.'.inc.php');
于 2012-10-10T07:49:10.030 回答