各位大侠,现在我碰到这么一个奇怪的问题。
我用file_get_contents函数把模板文件读取出来,如果里面的链接这样写<a href="/index.php">链接</a>
读取到字符串就会变成<a href="/www/index.php">链接</a>
如果是<a href="index.php">链接</a>,就不会变。
www是我放页面文件的文件夹名称。
空间我是使用的新网的虚拟主机,unix系统。先行拜谢!
我用file_get_contents函数把模板文件读取出来,如果里面的链接这样写<a href="/index.php">链接</a>
读取到字符串就会变成<a href="/www/index.php">链接</a>
如果是<a href="index.php">链接</a>,就不会变。
www是我放页面文件的文件夹名称。
空间我是使用的新网的虚拟主机,unix系统。先行拜谢!
我自己写的测试页面如下
<?php
require_once(dirname(__FILE__) . '/app.php');
//echo($WEB_ROOT.'<br />');
//echo($INI['skin']['template']);
$tFile = 'test';
$tFileN = preg_replace( '/\.html$/', '', $tFile);
$tFile = DIR_TEMPLATE . '/' . $tFileN . '.html';
$cFile = DIR_COMPILED . '/' . str_replace('/','_',$tFileN) . '.php';
$fileContent = file_get_contents($tFile);
echo('1:'.$DIR_TEMPLATE.'<br />');
echo('2:'.$tFileN.'<br />');
echo('3:'.DIR_TEMPLATE . '/' . $tFileN . '.html'.'<br />');
echo('目录:'.$tFile.'<br />');
//$fileContent = preg_replace( '/^(\xef\xbb\xbf)/', '', $fileContent ); //EFBBBF
$fileContent = str_replace( '/www', '', $fileContent); //
echo($fileContent);
?>这样应该不是后台自己添加的问题了吧
吧引用的app.php去掉就不会有这问题了。
static private $_instance = null;
static private $_debug = false; static public function Init($debug=false)
{
self::$_instance = new Session();
self::$_debug = $debug;
session_start();
}红色的这句注释掉就没事了,这是为什么?
有这样一个类
class Session
self::$_instance = new Session();//注释掉这句就没事function __construct()
{
self::$_begin = microtime(true);
}这是构造函数
何况你注释掉它后程序不报错吗?如果不报错,那么这个对象又有什么用?
$docroot = rtrim(str_replace('\\','/',$document_root),'/');
if(!$docroot) {
$script_filename = $_SERVER['SCRIPT_FILENAME'];
$script_filename = str_replace('\\','/',$script_filename);
$script_name = $_SERVER['SCRIPT_NAME'];
$script_name = str_replace('\\','/',$script_name);
$lengthf = strlen($script_filename);
$lengthn = strlen($script_name);
$length = $lengthf - $lengthn;
$docroot = rtrim(substr($script_filename,0,$length),'/');
}
$webroot = trim(substr(WWW_ROOT, strlen($docroot)), '\\/');
echo($webroot);这一段代码在win系统+iis下没问题,在linux下就会多出一段来,可折腾死我了
再次谢谢大家,结贴!