Home > Backend Development > PHP Tutorial > 目录路径有关问题

目录路径有关问题

PHP中文网
Release: 2023-02-28 13:00:01
Original
1106 people have browsed it

目录路径问题
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
另,标准的路径分隔符是 / ,不是\
------解决方案--------------------
弄清楚相关路径的问题
./  同级
../ 上一级

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Latest Articles by Author
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template