简体   繁体   English

php Include - 文件夹中的文件

[英]php Include - file in a folder

I'm using php include in the index file to include banner (graphic on my page).我在索引文件中使用 php include 来包含横幅(我页面上的图形)。

The files are in the folders:文件位于以下文件夹中:

C:\Users\name\IBM\rationalsdp\workspace\RemSysTempFls\ERIC\www\apachedft\htdocs\fender400\gk\index.php 

RemSysTempFls\\ERIC\\www\\apachedft\\htdocs\\fender400\\banner.php RemSysTempFls\\ERIC\\​​www\\apachedft\\htdocs\\fender400\\banner.php

I am unable to include banner.php with the following:我无法将 banner.php 包含在以下内容中:

include ('/fender400/banner.php');

and get the errors (the page still runs):并得到错误(页面仍在运行):

Warning: main(/fender400/banner.php): failed to open stream: No such file or directory in /www/apachedft/htdocs/fender400/gk/index.php on line 16警告:main(/fender400/banner.php):无法打开流:第 16 行的 /www/apachedft/htdocs/fender400/gk/index.php 中没有这样的文件或目录

Warning: main(): Failed opening '/fender400/banner.php' for inclusion (include_path='.:/QOpenSys/php//lib/php') in /www/apachedft/htdocs/fender400/gk/index.php on line 16警告:main():在 /www/apachedft/htdocs/fender400/gk/index.php 中打开“/fender400/banner.php”以包含(include_path='.:/QOpenSys/php//lib/php')失败在第 16 行

Are you sure that the addresses of each of those files are correct?您确定每个文件的地址都正确吗?

Try it without the initial slash and see what it tells you尝试不使用初始斜杠,看看它告诉你什么

include ('fender400/banner.php');

or try:或尝试:

include ('../../fender400/banner.php');

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM