dedecms 修改文档 空白页面解决方法

 更新时间:2016年11月25日 15:53  点击:1788

 我碰到的问题是发布内容没有问题,但是编辑文档,修改软件是就出现空白页面,经过查找,只要如下修改就ok了。
 找到dede/(就是你的后台登录目录,如果没修改默认是dede目录),找到文件archives_do.php教程文件,搜索header,在33行可以看到

 代码如下 复制代码
 header("location:{$gurl}?aid=$aid");


 我们把这里修改成js调用如

 代码如下 复制代码
 echo "<script language='网页特效'>window.location.href='{$gurl}?aid={$aid}'</script> ";


 
 至于什么原因不用能header函数呢,下面我们来看看关于header的属性。header()前,如果前面输出了空格、空行、任何字符,都会导致header()跳转失效....
由于catalog_do.php调用过的php文件太多了,可能你以前用启事本修改过文件,所以就出问题了。

 本站原创文章转载注明来源于http://www.111cn.net/phper/php.html

// 浏览页面次数

 代码如下 复制代码

$visited = (int)$_cookie['pagevisits'] + 1;

setcookie( 'pagevisits',    // cookie名
     $visited,     // cookie值
   time()+7*24*60*60   // 过期时间
          ); 

?>

<!doctype html public "-//w3c//dtd xhtml 1.0 strict//en" "http://www.w3.org/tr/xhtml1/dtd/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312" />
<title>使用jquery+php获取和设置cookies</title>

<link rel="stylesheet" type="text/css教程" href="styles.css" />

<script type="text/网页特效" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.cookie.js">

jquery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toutcstring)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new date();
                date.settime(date.gettime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toutcstring(); // use expires attribute, max-age is not supported by ie
        }

        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeuricomponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookievalue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jquery.trim(cookies[i]);
                // does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookievalue = decodeuricomponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookievalue;
    }
};
</script>
<script type="text/javascript">

$(document).ready(function(){
 
 var cookie = $.cookie('democookie');
 
 if(cookie) $('.jq-text').text(cookie).show();
 
        
 $('.fields a').click(function(e){
  var text = $('#inputbox').val();
  
  // 设置cookie的值
  $.cookie('democookie',text,{expires: 7});
  
  $('.jq-text').text(text).slidedown('slow');
  
  e.preventdefault();
 });
 
 $('#form1').submit(function(e){ e.preventdefault(); })
})

</script>

</head>

<body>
<h1>使用jquery+php获取和设置cookies</h1>

<div class="section">
 <div class="counter"><?php echo $visited?></div>
    <p>你访问此页面的次数</p>
</div>


<div class="section">
 
    <div class="jq-text"></div>

 <form action="" method="get" id="form1">
     <div class="fields">
         <input type="text" id="inputbox" />
            <a href="">保存</a>
        </div>
    </form>
    <p>你可以在输入框输入任意值,当你重新打开页面时,值依旧存在。</p>
</div>

</body>
</html>


源码下载
http://down.111cn.net/down/code/jquery/2010/0909/20704.html

function whois_hichina($domain) {
preg_match("|<pre>(.+?)</pre>|is", @file_get_contents('http://whois.hichina.com/cgi-bin/whois?domain='.$domain.''), $whois);

$whois[0] = str_replace('友情提示:按注册局要求,过期域名可能会处于注册商自动续费期阶段,您在此查询所看到的域名到期日仅供参考<br />请您<a href="http://www.net.cn/has_client/userlogon/user_logon1.asp教程" target="_blank" class="link_gl">进入会员区</a>查看该域名的实际到期时间,并请及时进行续费,谢谢!', '', ($whois[0]));//过滤掉此段文字


return $whois[0]);

}

//新网 whois (非新网提供,只是根据新网自身网站的url修改实现)
function whois_xinnet($domain) {
preg_match("|<div class="lytableinfowrap">(.+?)</div>|is", @file_get_contents('http://www.xinnet.cn/modules/agent/serv/pages/domain_whois.jsp教程?domainnamewhois='.$domain.'&nocode=nocode'), $whois);

return $whois[0];
}
}

 代码如下 复制代码
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=gb2312">
<title>创建、复制、移动、删除文件</title>
<style type="text/css教程">
<!--
body {
margin-left: 00px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
-->
</style></head>
<body>
<table width="350" border="1" cellpadding="0" cellspacing="0">
<tr>
<td><table width="350" height="80" border="0" cellpadding="0" cellspacing="0" background="images/326ssss.gif">
<form name="form1" method="post" action="index.php教程">
<tr>
<td width="95" height="39"> </td>
<td width="171" rowspan="2" align="left" valign="middle"> <input name="fopens" type="text" id="copy2" size="22"></td>
<td width="84" rowspan="2" valign="middle"><input name="submit4" type="submit" id="submit4" value="提交"></td>
</tr>
<tr>
<td height="41"> </td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td><table width="350" height="80" border="0" cellpadding="0" cellspacing="0" background="images/326s.gif">
<form name="form1" method="post" action="index.php">
<tr>
<td width="111" height="39"> </td>
<td width="155" valign="bottom"><input name="copys" type="text" id="copys2" size="20">
</td>
<td width="84" rowspan="2" valign="middle"><input type="submit" name="submit" value="提交"></td>
</tr>
<tr>
<td height="41"> </td>
<td valign="top"><input name="copy2" type="text" id="copy22" size="20"></td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td><table width="350" height="80" border="0" cellpadding="0" cellspacing="0" background="images/326ss.gif">
<form name="form1" method="post" action="index.php">
<tr>
<td width="111" height="39"> </td>
<td width="115" valign="bottom"><input name="moves" type="text" id="moves3" size="20">
</td>
<td width="84" rowspan="2"><input type="submit" name="submit2" value="提交"></td>
</tr>
<tr>
<td height="41"> </td>
<td valign="top"><input name="moves2" type="text" id="moves22" size="20"></td>
</tr>
</form>
</table></td>
</tr>
<tr>
<td><table width="350" height="80" border="0" cellpadding="0" cellspacing="0" background="images/326sss.gif">
<form name="form1" method="post" action="index.php">
<tr>
<td width="104"> </td>
<td width="236"><input name="delete" type="text" id="delete2">
<input type="submit" name="submit3" value="提交"></td>
</tr>
</form>
</table></td>
</tr>
</table>
</body>
</html>

php代码

 代码如下 复制代码

<?php session_start();
if($submit=="提交"){
$copy=$_post[copys];
$copys2=$_post[copy2];
if(copy($copy,$copys2)==true){echo "复制成功!!";}else{echo "失败!!";};
}
if($submit2=="提交"){
$moves=$_post[moves];
$moves2=$_post[moves2];
if(rename($moves,$moves2)==true){echo "移动成功!!";}else{echo "失败!!";};
}

if($submit3=="提交"){
$delete=$_post[delete];
if(unlink($delete)==true){echo "删除成功!!";}else{echo "失败!!";};
}
if($submit4=="提交"){
$fopens=$_post[fopens];
if(fopen($fopens,"w")==true){echo "创建成功!!";}else{echo "失败!!";};
}

?>

一、编码范围
1. gbk (gb2312/gb18030)
x00-xff gbk双字节编码范围
x20-x7f ascii
xa1-xff 中文
x80-xff 中文

2. utf-8 (unicode)
u4e00-u9fa5 (中文)
x3130-x318f (韩文)
xac00-xd7a3 (韩文)
u0800-u4e00 (日文)
ps教程: 韩文是大于[u9fa5]的字符

正则例子:
preg_replace("/([x80-xff])/","",$str);
preg_replace("/([u4e00-u9fa5])/","",$str);

二、代码例子

//判断内容里有没有中文-gbk (php教程)
function check_is_chinese($s){
    return preg_match('/[x80-xff]./', $s);
}
//获取字符串长度-gbk (php)
function gb_strlen($str){
    $count = 0;
    for($i=0; $i<strlen($str); $i++){
        $s = substr($str, $i, 1);
        if (preg_match("/[x80-xff]/", $s)) ++$i;
        ++$count;
    }
    return $count;
}
//截取字符串字串-gbk (php)
function gb_substr($str, $len){
    $count = 0;
    for($i=0; $i<strlen($str); $i++){
        if($count == $len) break;
        if(preg_match("/[x80-xff]/", substr($str, $i, 1))) ++$i;
        ++$count;      
    }
    return substr($str, 0, $i);
}
//统计字符串长度-utf8 (php)
function utf8_strlen($str) {
    $count = 0;
    for($i = 0; $i < strlen($str); $i++){
        $value = ord($str[$i]);
        if($value > 127) {
            $count++;
            if($value >= 192 && $value <= 223) $i++;
            elseif($value >= 224 && $value <= 239) $i = $i + 2;
            elseif($value >= 240 && $value <= 247) $i = $i + 3;
            else die('not a utf-8 compatible string');
        }
        $count++;
    }
    return $count;
}

//截取字符串-utf8(php)
function utf8_substr($str,$position,$length){
    $start_position = strlen($str);
    $start_byte = 0;
    $end_position = strlen($str);
    $count = 0;
    for($i = 0; $i < strlen($str); $i++){
        if($count >= $position && $start_position > $i){
            $start_position = $i;
            $start_byte = $count;
        }
        if(($count-$start_byte)>=$length) {
            $end_position = $i;
            break;
        }  
        $value = ord($str[$i]);
        if($value > 127){
            $count++;
            if($value >= 192 && $value <= 223) $i++;
            elseif($value >= 224 && $value <= 239) $i = $i + 2;
            elseif($value >= 240 && $value <= 247) $i = $i + 3;
            else die('not a utf-8 compatible string');
        }
        $count++;
    }
    return(substr($str,$start_position,$end_position-$start_position));
}

//字符串长度统计-utf8 [中文3个字节,俄文、韩文占2个字节,字母占1个字节] (ruby)
def utf8_string_length(str)
    temp = cgi::unescape(str)
    i = 0;
    j = 0;
    temp.length.times{|t|
        if temp[t] < 127
            i += 1
        elseif temp[t] >= 127 and temp[t] < 224
            j += 1
            if 0 == (j % 2)
                i += 2
                j = 0
            end
        else
            j += 1
            if 0 == (j % 3)
                i +=2
                j = 0
            end
        end
    }
    return i
}

//判断是否是含有韩文-utf-8 (网页特效)
function checkkoreachar(str) {
    for(i=0; i<str.length; i++) {
        if(((str.charcodeat(i) > 0x3130 && str.charcodeat(i) < 0x318f) || (str.charcodeat(i) >= 0xac00 && str.charcodeat(i) <= 0xd7a3))) {
            return true;
        }
    }
    return false;
}

//判断是否有中文字符-gbk (javascript)
function check_chinese_char(s){
    return (s.length != s.replace(/[^x00-xff]/g,"**").length);
}

[!--infotagslink--]

相关文章

  • php 中file_get_contents超时问题的解决方法

    file_get_contents超时我知道最多的原因就是你机器访问远程机器过慢,导致php脚本超时了,但也有其它很多原因,下面我来总结file_get_contents超时问题的解决方法总结。...2016-11-25
  • php抓取网站图片并保存的实现方法

    php如何实现抓取网页图片,相较于手动的粘贴复制,使用小程序要方便快捷多了,喜欢编程的人总会喜欢制作一些简单有用的小软件,最近就参考了网上一个php抓取图片代码,封装了一个php远程抓取图片的类,测试了一下,效果还不错分享...2015-10-30
  • HTTP 408错误是什么 HTTP 408错误解决方法

    相信很多站长都遇到过这样一个问题,访问页面时出现408错误,下面一聚教程网将为大家介绍408错误出现的原因以及408错误的解决办法。 HTTP 408错误出现原因: HTT...2017-01-22
  • Android子控件超出父控件的范围显示出来方法

    下面我们来看一篇关于Android子控件超出父控件的范围显示出来方法,希望这篇文章能够帮助到各位朋友,有碰到此问题的朋友可以进来看看哦。 <RelativeLayout xmlns:an...2016-10-02
  • ps把文字背景变透明的操作方法

    ps软件是现在非常受大家喜欢的一款软件,有着非常不错的使用功能。这次文章就给大家介绍下ps把文字背景变透明的操作方法,喜欢的一起来看看。 1、使用Photoshop软件...2017-07-06
  • intellij idea快速查看当前类中的所有方法(推荐)

    这篇文章主要介绍了intellij idea快速查看当前类中的所有方法,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友可以参考下...2020-09-02
  • Mysql select语句设置默认值的方法

    1.在没有设置默认值的情况下: 复制代码 代码如下:SELECT userinfo.id, user_name, role, adm_regionid, region_name , create_timeFROM userinfoLEFT JOIN region ON userinfo.adm_regionid = region.id 结果:...2014-05-31
  • js导出table数据到excel即导出为EXCEL文档的方法

    复制代码 代码如下: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta ht...2013-10-13
  • mysql 批量更新与批量更新多条记录的不同值实现方法

    批量更新mysql更新语句很简单,更新一条数据的某个字段,一般这样写:复制代码 代码如下:UPDATE mytable SET myfield = 'value' WHERE other_field = 'other_value';如果更新同一字段为同一个值,mysql也很简单,修改下where即...2013-10-04
  • ps怎么制作倒影 ps设计倒影的方法

    ps软件是一款非常不错的图片处理软件,有着非常不错的使用效果。这次文章要给大家介绍的是ps怎么制作倒影,一起来看看设计倒影的方法。 用ps怎么做倒影最终效果&#819...2017-07-06
  • js基础知识(公有方法、私有方法、特权方法)

    本文涉及的主题虽然很基础,在许多人看来属于小伎俩,但在JavaScript基础知识中属于一个综合性的话题。这里会涉及到对象属性的封装、原型、构造函数、闭包以及立即执行表达式等知识。公有方法 公有方法就是能被外部访问...2015-11-08
  • 安卓手机wifi打不开修复教程,安卓手机wifi打不开解决方法

    手机wifi打不开?让小编来告诉你如何解决。还不知道的朋友快来看看。 手机wifi是现在生活中最常用的手机功能,但是遇到手机wifi打不开的情况该怎么办呢?如果手机wifi...2016-12-21
  • PHP 验证码不显示只有一个小红叉的解决方法

    最近想自学PHP ,做了个验证码,但不知道怎么搞的,总出现一个如下图的小红叉,但验证码就是显示不出来,原因如下 未修改之前,出现如下错误; (1)修改步骤如下,原因如下,原因是apache权限没开, (2)点击打开php.int., 搜索extension=ph...2013-10-04
  • c#中分割字符串的几种方法

    单个字符分割 string s="abcdeabcdeabcde"; string[] sArray=s.Split('c'); foreach(string i in sArray) Console.WriteLine(i.ToString()); 输出下面的结果: ab de...2020-06-25
  • js控制页面控件隐藏显示的两种方法介绍

    javascript控制页面控件隐藏显示的两种方法,方法的不同之处在于控件隐藏后是否还在页面上占位 方法一: 复制代码 代码如下: document.all["panelsms"].style.visibility="hidden"; document.all["panelsms"].style.visi...2013-10-13
  • 连接MySql速度慢的解决方法(skip-name-resolve)

    最近在Linux服务器上安装MySql5后,本地使用客户端连MySql速度超慢,本地程序连接也超慢。 解决方法:在配置文件my.cnf的[mysqld]下加入skip-name-resolve。原因是默认安装的MySql开启了DNS的反向解析。如果禁用的话就不能...2015-10-21
  • C#方法的总结详解

    本篇文章是对C#方法进行了详细的总结与介绍,需要的朋友参考下...2020-06-25
  • Zend studio文件注释模板设置方法

    步骤:Window -> PHP -> Editor -> Templates,这里可以设置(增、删、改、导入等)管理你的模板。新建文件注释、函数注释、代码块等模板的实例新建模板,分别输入Name、Description、Patterna)文件注释Name: 3cfileDescriptio...2013-10-04
  • EXCEL数据上传到SQL SERVER中的简单实现方法

    EXCEL数据上传到SQL SERVER中的方法需要注意到三点!注意点一:要把EXCEL数据上传到SQL SERVER中必须提前把EXCEL传到服务器上.做法: 在ASP.NET环境中,添加一个FileUpload上传控件后台代码的E.X: 复制代码 代码如下: if...2013-09-23
  • mysql锁定单个表的方法

    mysql锁定单个表的方法 复制代码 代码如下:mysql>lock table userstat read; mysql>unlock tables; 页级的典型代表引擎为BDB。 表级的典型代表引擎为MyISAM,MEMORY以及很久以前的ISAM。 行级的典型代表引擎为INN...2014-05-31