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 src="image/js.js">
当所有其他文件来包含head.php会出错(在query文件下)当wc.php这样引用时会报错,就是找不到db.class.php
include ("../head.php");
我在右键查看源代码:发现给解析成了:
c://www/query/image/js.js
你知道,实际上的在
c://www/image/js.js
只是用了inclue了给加载错了
这个应该怎么写???
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 src="image/js.js">
当所有其他文件来包含head.php会出错(在query文件下)当wc.php这样引用时会报错,就是找不到db.class.php
include ("../head.php");
我在右键查看源代码:发现给解析成了:
c://www/query/image/js.js
你知道,实际上的在
c://www/image/js.js
只是用了inclue了给加载错了
这个应该怎么写???
head.php 中 require_once "db.class.php";
wc.php 中 include ("../head.php");
不会出现找不到 db.class.php 的问题2、head.php 中 <script src="image/js.js"> 使用了相对路径
对于 query/wc.php 会出现文件找不到的问题
应使用绝对路径
<script src="/image/js.js">
<script src="/image/js.js">是可以解析这个问题。
但是一般都有个工程名,就是我所网站名,如wms4
<script src="/wms4/image/js.js">
若这般写,都可以处理好,解决好。但是,大哥,我仍有一问?
这样写,以后若改了工程名,就要写所有的引用中的
<script src="/wms5/image/js.js">大哥,有无其他法子
原项目名 wms4
wms4/image/js.js
wms4/index.php 其中有 <script src="image/js.js">
修改项目名后
wms5/image/js.js
wms5/index.php 其中的 <script src="image/js.js"> 依然有效
<script src="wms4/image/js.js">---这是绝对引用
<script src="/wms4/image/js.js">--这是相对
2.请你给我一个规范吧,就是百度,淘宝是如何做的?你是如何实现的。我想当成今生之范式。
<script src="/wms4/image/js.js">--这是相对
?????
正好反了