您的位置:首页 > 编程语言 > PHP开发

php 解决 引用 路径 php 中引用 ext 解决路径问题 简单实用

2010-03-23 18:23 447 查看
这个文件就是extjs.php文件,其实这里名字并不重要,我已经做了处理,保证能拼接处想要的url。

但是还是建议使用extjs.php来命名,因为个觉得见名知意。

<?php

/*
* put this file with ext source code in the same folder
*
* such as :
*  extjs/adapter/...
*  extjs/resources/...
*  extjs/ext-all.js
*
*  extjs/extjs.php
* invoke code: require_once("./JS/extjs/extjs.php");
*/

$fileRelativePath   =   str_replace("//","/",substr(__FILE__,strlen($_SERVER['DOCUMENT_ROOT'])));
//JS/extjs/extjs.php

$serverUrl          =   "http://".$_SERVER[SERVER_NAME].":".$_SERVER[SERVER_PORT];
//http://192.168.1.56:81

$selfname           =   basename(__FILE__);
//extjs.php

$extpath            =   str_replace("/".$selfname,"",$serverUrl.$fileRelativePath);
?>
<link rel="stylesheet" type="text/css" href="<?echo $extpath?>/resources/css/ext-all.css">
<mce:script type="text/javascript" src="<?echo $extpath?><!--
/adapter/ext/ext-base.js">
// --></mce:script>
<mce:script type="text/javascript" src="<?echo $extpath?><!--
/ext-all.js">
// --></mce:script>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐