文件夹
FB / FB-include.php
的index.php
我打算在我的index.php中访问我的fb-include.php,我在索引页面上有这一行。
require_once('/fb/fb-include.php');
它可以在我的localhost wamp上运行,但是当我更新到服务器时,它将不再工作。
我也试试这个
$root = realpath($_SERVER["DOCUMENT_ROOT"]);
require_once('$root/fb/fb-include.php');
我做错了什么?我有没有办法进入该文件夹仍然使用require_once或我应该使用include? p>
答案 0 :(得分:0)
像这样更新您的代码
require_once $root.'/fb/fb-include.php';
或
require_once($root.'/fb/fb-include.php');
并且需要确保root给你的rootpath
或者您可以像这样使用
require_once('fb/fb-include.php')