dongza1708 2014-01-27 16:03
浏览 47

php文件夹结构XAMPP

Using PHP (XAMPP)

I have a simple folder layout as such:

Folder Layout

For right now, my index.php file just contains "mainbar.php"

mainbar.php:

<?php
  require(config.php);
  include ("login/session.php");
  global $session;
  $logged=$session->CheckSession();
?>
<!DOCTYPE html>
<html>
<head>
  <script src='scripts/jquery.js'></script>
  <link rel='stylesheet' href='styles/mainbar.css'/>
</head>
<body>
<section class='topcontainer'>
  <nav id='mainnav'>
    <ul>
      <li><a href='#' class='acti' id='homepage'>Home<span class='badge red'>3</span></a></li>
      <li><a href='qms/qms.php' id='qmspage'>QMS<span class='badge yellow'>35</span></a></li>
      <li><a href='#' id='modelpage'>Model Search</a></li>
      <li><a href='#' id='partsdbpage'>Parts Database</a></li>      
      <li><a href='#' id='wddbpage'>WD Database</a></li>
      <li><a href='#' id='toolspage'>Tools</a></li>
      <li><img src='styles/img/profile.png' width='25px'/></li>
    </ul>
  </nav>
</section>

When the user clicks on the "QMS" button (href='qms/qms.php').

I get the following error (using chrome):

Failed to load resource (http://localhost/control/qms/scripts/jquery.js)

PHP is going to the directory "qms" and then trying to find the "scripts" folder which I do not want it to do.

Keep in mind I just can't make it say "../scripts/jquery.js" because that may not always be the case.

How do I set this up so that "jquery.js" will have a permanent reference back to the parent folder "control/scripts/"??

  • 写回答

2条回答 默认 最新

  • duanchu0031 2014-01-27 16:12
    关注

    you can just do as :

    <script src='http://localhost/control/scripts/jquery.js'></script>

    or use some global variable for this purpose

    评论

报告相同问题?

悬赏问题

  • ¥15 keil的map文件中Image component sizes各项意思
  • ¥30 BC260Y用MQTT向阿里云发布主题消息一直错误
  • ¥20 求个正点原子stm32f407开发版的贪吃蛇游戏
  • ¥15 划分vlan后,链路不通了?
  • ¥20 求各位懂行的人,注册表能不能看到usb使用得具体信息,干了什么,传输了什么数据
  • ¥15 Vue3 大型图片数据拖动排序
  • ¥15 Centos / PETGEM
  • ¥15 划分vlan后不通了
  • ¥20 用雷电模拟器安装百达屋apk一直闪退
  • ¥15 算能科技20240506咨询(拒绝大模型回答)