2017-04-04 63 views
0

文件夹require_once在服务器不工作

FB/FB-include.php

的index.php

我要访问我的FB-include.php在我index.php,我在我的索引页面有这条线。

require_once('/fb/fb-include.php'); 

它工作在我的本地主机上,但是当我更新到服务器时,它不再工作。

我也试试这个

$root = realpath($_SERVER["DOCUMENT_ROOT"]); 

require_once('$root/fb/fb-include.php'); 

我做错了什么?有什么办法,我进入该文件夹仍然使用require_once或应该使用include?

+2

可能的复制[有什么不同在单引号和双引号字符串之间的PHP?](http://stackoverflow.com/questions/3446216/what-is-the-difference-between-single-quoted-and-double-quoted-strings-in -php) –

+0

'require_once('fb/fb-include.php');'试试这个 –

+0

试试require_once($ root。'/ fb/fb-include.php'); –

回答

0

更新你这样的代码

require_once $root.'/fb/fb-include.php'; 

require_once($root.'/fb/fb-include.php'); 

,需要确保根给你ROOTPATH

,或者你可以使用这样

require_once('fb/fb-include.php')