1

我在 Windows 7 中使用 wamp 和 codeigniter 在 php 中开发 MVC 应用程序。该应用程序可以正常工作。

我对 linux 和 ubuntu 完全陌生。

但我需要在 ubuntu linux 机器上托管它。我<php include ('/../footer.php); ?>在 windows wamp 中使用过,它正在工作。

一旦我上传到 ubuntu 灯。我越来越include ('/../footer.php) failed to open stream

我尝试在网上搜索但无法找到解决方案。

如何解决这个问题。

4

1 回答 1

5

Drop the leading / and change your includes to

 include("../footer.php");

the leading / means from the root of the file system.

You are digging below the root and there just ain't nothing there.

Another thing to beware of when dealing with problems between windows and linux is that on windows ../footer.php is the same as ../Footer.php which is not the case on linux (case sensitive vs case insensitive file systems).

UPDATE

The final solution was to for the relative path for the include into a absolute one by prefixing it with __DIR__ as in ...

include(__DIR__."/../footer.php");
于 2013-06-30T06:55:38.563 回答