PHP 包含在 ubuntu 服务器中运行的 lamp 中
我已经在ubuntu服务器上安装了LAMP。它工作得很好..我有一个 php 应用程序,它有一个文件夹结构,根文件夹有
- index.php
- {Database}
- localhost.php
- {模块}
- 模块1.php
- module2.php
- module3.php
- {模块3}
- submod1.php
- submod2.php
基于 _GET 模块包含在 index.php 中,
include('Modules/module2.php');
效果非常好..但是在 module1.php 中,当我尝试包含 localhost.php 时靠它
include('/Database/localhost.php');
是行不通的。为什么它不起作用......
注意:相同的代码在我的 Windows 7 中的 WAMP 中完美运行。
I have installed LAMP in ubuntu server. and its working good.. i have a php application which has a folder structure the root folder has
- index.php
- {Database}
- localhost.php
- {Modules}
- module1.php
- module2.php
- module3.php
- {MODULE3}
- submod1.php
- submod2.php
based on _GET the modules are included in index.php by
include('Modules/module2.php');
which works out perfectly well.. but in the module1.php when i try to include localhost.php by
include('/Database/localhost.php');
it doesn't work out. why is that it's not working..
NOTE:the same code works perfectly in WAMP in my windows 7.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
“数据库”前面有一个斜杠
You have a slash in front of "Database"
/Database/ 之前的斜杠不应该在那里,因为 php 尝试从 / (根文件夹)查找该文件。
通常最好有一个定义的起始路径点,例如:
然后将其用作所有其他包含文件的基础。
the slash before /Database/ shouldn't be there because php tries to find the file from / (root folder).
Usually it's better to have a defined starting path point like:
And then to use it as a base for all other included files.