欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  后端开发

目录路径有关问题

程序员文章站 2024-01-14 13:15:04
...
目录路径问题
bishe是根目录,里面包含一个
一级目录regist.PHP和control文件夹,index.php
二级目录control文件夹里面包含register.PHP
register.PHP里面跳转语句到index.php
echo "<script>window.location.href='index.php';</script>";
结果实际路径是bishe\control\index.php
我想要的是bishe\index.php
怎么修改?
------解决方案--------------------
echo "<script>window.location.href='../index.php';</script>";
------解决方案--------------------
<script>window.location.href='/index.php';</script>
/index.php 代表在根目录下的index.php
或者: ../index.php 代表在上一层目录下的index.php ,在你的需求中是同一效果
index.php 或 ./index.php 代表在当前目录下的index.php
另,标准的路径分隔符是 / ,不是\
------解决方案--------------------
弄清楚相关路径的问题
./ 同级
../ 上一级