大家好,刚才发现了这段代码
<?PHP
if (isset($_GET['id'])) {
if (!empty($_GET['id']) && $_GET['id'] != "index") {
if (file_exists($_GET['id'].".php")) {
include ("./".$_GET['id'].".php");
} else {
echo "Not Found section";
}
} else {
include ("start.php");
}
} else {
include ("start.php");
} ?>
<a href="index.php?id=gallery">Gallery</a>
我想使用它,但我有我的文件在另一个文件夹:"FILESPHP",我怎么能使链接到FILESPHP文件夹?. .谢谢。
考虑使用google。
- 与
getcwd()
,你得到你的当前目录 - 你可以从那里导航,就像在每一个linux
:
<?PHP
if (isset($_GET['id'])) {
if (!empty($_GET['id']) && $_GET['id'] != "index") {
if (file_exists($_GET['id'].".php")) {
include ("./FILESPHP/".$_GET['id'].".php");
} else {
echo "Not Found section";
}
} else {
include ("FILESPHP/start.php");
}
} else {
include ("FILESPHP/start.php");
} ?>
谢谢inetphantom,
当刷新页面…FILESPHP/start.php
load very GOOD.
但. .当我调用文件在FILESPHP..不工作. .
<a href="index.php?id=gallery">Gallery</a>
show "Not Found section"