php教程

超轻量级php框架startmvc

php分页查询mysql结果的base64处理方法示例

更新时间:2020-03-19 19:21 作者:startmvc
本文实例讲述了php分页查询mysql结果的base64处理方法。分享给大家供大家参考,具体如下:p

本文实例讲述了php分页查询mysql结果的base64处理方法。分享给大家供大家参考,具体如下:


public function public_about(){
 $sql= "SELECTc.catid,c.catname,c.catdir,FROM_BASE64(p.content) FROM v9_page p JOINv9_category c ON c.catid=p.catid WHERE c.parentdir = 'jmwm/'";
 if(isset($_REQUEST['biaoshi'])){
 $sql= "SELECTc.catid,c.catname,c.catdir,p.content FROM v9_page p JOIN v9_category c ONc.catid=p.catid WHERE c.catdir LIKE '{$_REQUEST['biaoshi']}%'";
 }
 $mydb= pc_base::load_model('mymodel');
 $mpages= $mydb->query_listinfo($sql);
 $this->array_to_base64($mpages);
 // $article['content']=base64_encode(toUtf8($article['content']));
 $msg= array();
 $msg['returncode']= "0";
 $msg['msg']= togbk("关于联系");
 $msg['comment']= $mpages;
 echo jsonFormat($msg);
// return_Msg(0,"关于联系",$mpages);
}
public function array_to_base64(&$array){
 foreach($array as $key => $value) {
 if(is_array($value)) {
 $this->array_to_base64($array[$key]);
 } elseif($key=="content"){
 $array[$key]=base64_encode(toUtf8($value));
 }else{
 $array[$key]=togbk($value);
 }
 }
}

PS:这里再为大家提供几款比较实用的base64在线编码解码工具供大家使用:

BASE64编码解码工具: http://tools.jb51.net/transcoding/base64

在线图片转换BASE64工具: http://tools.jb51.net/transcoding/img2base64

Base64在线编码解码 UTF-8版: http://tools.jb51.net/tools/base64_decode-utf8.php

Base64在线编码解码 gb2312版: http://tools.jb51.net/tools/base64_decode-gb2312.php