php引出文件之策略,有难度,请给个规范

WBOY
Release: 2016-06-13 12:50:34
Original
772 people have browsed it

php引入文件之策略,有难度,请给个规范
c://www/head.php
c://www/db.class.php
c://www/query/wc.php
在head.php中有文件db.class.php
即在head.php中有require_once "db.class.php";
在head.php中有<script><br /> 当所有其他文件来包含head.php会出错(在query文件下)<br /> <br /> 当wc.php这样引用时会报错,就是找不到db.class.php<br /> include ("../head.php");<br /> 我在右键查看源代码:发现给解析成了:<br /> c://www/query/image/js.js<br /> 你知道,实际上的在<br /> c://www/image/js.js<br /> 只是用了inclue了给加载错了<br /> 这个应该怎么写??? <div class="tag "> </script>


------解决方案--------------------
1、
head.php 中 require_once "db.class.php";
wc.php 中 include ("../head.php"); 
不会出现找不到 db.class.php 的问题

2、head.php 中 <script> 使用了相对路径<br /> 对于 query/wc.php 会出现文件找不到的问题<br /> 应使用绝对路径<br /> <script src="<span style="color: #FF0000;">/image/js.js"><br><font color='#FF8000'>------解决方案--------------------<br>用一个变量来做项目名啦 <br><font color='#FF8000'>------解决方案--------------------<br><script src="wms4/image/js.js">---这是绝对引用<br /> <script src="/wms4/image/js.js">--这是相对<br /> ?????<br /> 正好反了 <div class="clear"> </script>
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!