温馨提示×

温馨提示×

您好,登录后才能下订单哦!

密码登录×
登录注册×
其他方式登录
点击 登录注册 即表示同意《亿速云用户服务条款》

在PHP中解码base64编码后出现乱码如何解决

发布时间:2021-03-04 16:09:49 来源:亿速云 阅读:299 作者:Leah 栏目:开发技术

在PHP中解码base64编码后出现乱码如何解决?很多新手对此不是很清楚,为了帮助大家解决这个难题,下面小编将为大家详细讲解,有这方面需求的人可以来学习下,希望你能有所收获。

php有什么用

php是一个嵌套的缩写名称,是英文超级文本预处理语言,它的语法混合了C、Java、Perl以及php自创新的语法,主要用来做网站开发,许多小型网站都用php开发,因为php是开源的,从而使得php经久不衰。

跳转模版代码如下:

<!DOCTYPE html><html><head><meta charset="utf-8"><meta name="author" content="" />

<title>跳转提示</title>
<style type="text/css">
*{ padding: 0; margin: 0; }
body{ background: #fff; font-family: '微软雅黑'; color: #333; font-size: 16px;  text-align:center; }
.system-message{ width:600px; margin:150px auto 0 auto; background:#f8f8f8; border:1px solid #ccc;-webkit-border-radius: 8px;-moz-border-radius: 8px;border-radius: 8px;-webkit-box-shadow: #666 0px 0px 10px;-moz-box-shadow: #666 0px 0px 10px;box-shadow: #666 0px 0px 10px;}
.system-message h2{ font-size:30px; font-weight:normal; height:100px; line-height:100px; color:#c60;}
.system-message .jump{ padding: 40px 0;}
.system-message .jump a{ color: #333;}
.system-message .success,.system-message .error{ height:60px; line-height:70px; font-size: 18px; color:#900;}
.system-message .detail{ font-size: 12px; line-height: 20px; margin-top: 12px; display:none}
</style>
</head>
<body>
    <div class="system-message">
        <?php if( $_GET['success'] ){?>
            <h2>:) &nbsp; 恭喜!</h2>
            <p class="success"><?php echo base64_decode($_GET['message']); ?></p>
        <?php }else{?>
            <h2>:( &nbsp; 出错了!</h2>
            <p class="error"><?php echo base64_decode($_GET['message']); ?></p>
        <?php }?>
        <p class="detail"></p>
        <p class="jump">系统将在 <b id="wait"><?php echo $_GET['time']; ?></b> 后跳转,可直接 <a id="href" href="<?php echo base64_decode($_GET['url']); ?>">点此跳转</a></p>
       
    </div>
<script type="text/javascript">
(function(){
var wait = document.getElementById('wait'),href = document.getElementById('href').href;
var interval = setInterval(function(){
 var time = --wait.innerHTML;
 if(time <= 0) {
  location.href = href;
  clearInterval(interval);
 };
}, 1000);
})();
</script>
</body>
</html>

PHP redirect函数定义如下:

复制代码 代码如下:


/* 提醒后跳转 */
function _alert( $success=true, $message='success', $time='3', $url='/'){
 header('Location:/include/redirect.php?success='.$success.'&message='.base64_encode($message).'&time='.$time.'&url='.base64_encode($url));
 exit;
}


假如在PHP中这样调用函数的话:

复制代码 代码如下:


$query = "update content set bid='$clean[bid]',title='$clean[title]',content='$clean[content]',path='$clean[path]' where id=".$clean['id'];
if( mysql_query($query) ){
 _alert(1,'修改成功',3,'/admin/manage.php');
}else{
 _alert(false,'修改失败'.mysql_error(),5,'/admin/manage.php');
}

看完上述内容是否对您有帮助呢?如果还想对相关知识有进一步的了解或阅读更多相关文章,请关注亿速云行业资讯频道,感谢您对亿速云的支持。

向AI问一下细节

免责声明:本站发布的内容(图片、视频和文字)以原创、转载和分享为主,文章观点不代表本网站立场,如果涉及侵权请联系站长邮箱:is@yisu.com进行举报,并提供相关证据,一经查实,将立刻删除涉嫌侵权内容。

AI