Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在使用 php 包含添加绝对路径。
$路径="/";
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
我正在使用类似的东西。我正在使用链接中的 ap 值来获取我的页面。我在这里也提取了您引用的片段
$pages_dir = 'inc/content'; include($pages_dir.'/'.$p.'.inc.php');