当前位置:首页 > 文章 > 帝国CMS > 正文内容

帝国cms网站标题关键词描述自动加密转换成乱码前台显示正常查看源码是乱码

3年前 (2022-10-22)帝国CMS13408

1、在e/class/userfun.php里添加自定义函数

error_reporting(E_ERROR); 
function unicode_encode($str){
	preg_match_all('/./u',$str,$matches);
	$unicodeStr = "";
	foreach($matches[0] as $m){
		//拼接
		$unicodeStr .= "&#".base_convert(bin2hex(iconv('UTF-8',"UCS-4",$m)),16,10).';';
	}
	$end = strrpos($unicodeStr, '#')+6;
	$unicodeStr = substr($unicodeStr, 0, $end);
	return $unicodeStr.';';
}

首页模板调用方式:

<title><?=unicode_encode($public_r[sitename])?></title>
[e:loop={'select siteintro,sitekey from [!db.pre!]enewspublic',1,24,0}]
<meta name="keywords" content="<?=unicode_encode($bqr[sitekey])?>" />
<meta name="description" content="<?=unicode_encode($bqr[siteintro])?>" />
帝国cms非首页调用网站关键词和描述的方法

1、在e/class/userfun.php里添加自定义函数 error_reporting(E_ERROR...

推荐 2022-08-27

列表页:

<?
$classid=$GLOBALS[navclassid];
$cinfo=$empire->fetch1("select classname,classpagekey,intro from {$dbtbpre}enewsclass where classid = $classid");
?>
<title><?=unicode_encode($cinfo[classname])?> - <?=unicode_encode($public_r[sitename])?></title>
<meta name="keywords" content="<?=unicode_encode($cinfo[classpagekey])?>" />
<meta name="description" content="<?=unicode_encode($cinfo[intro])?> " />

内容页:

<title><?=unicode_encode($navinfor[title])?> - <?=unicode_encode($public_r[sitename])?></title>
<meta name="keywords" content="<?=unicode_encode($navinfor[keyboard])?>" />
<meta name="description" content="<?=unicode_encode($navinfor[smalltext])?>" />

 

效果:

帝国cms网站标题关键词描述自动加密转换成乱码前台显示正常查看源码是乱码

扫描二维码推送至手机访问。

版权声明:本文由蓝博发布,如需转载请注明出处。

本文链接:https://blueboss.cn/p/663.shtml

“帝国cms网站标题关键词描述自动加密转换成乱码前台显示正常查看源码是乱码” 的相关文章

帝国CMS动态页支持栏目导航标签循环子栏目数据标签万能标签的调用

帝国CMS动态页支持栏目导航标签循环子栏目数据标签万能标签的调用

分享一种利用JS来实现支持栏目导航标签,万能标签,循环子栏目数据标签的方法。   第一步:在【模板】下面增加标签模板,标签模板内容如下:   页面模板内容(*): [!--empirenews.listtemp--]<!--list.var1-->[!--empirenews.list...

帝国CMS上传生成的随机文件名前面增加自定义前缀

帝国CMS上传生成的随机文件名前面增加自定义前缀

帝国CMS上传生成的随机文件名前面怎么实现增加自定义前缀呢?如何实现?帝国CMS默认上传文件后生成一个32位的随机名称,今天教大家的方法可以在这个32位的随机名称前增加固定名称。 比如,增加 lexiw_ 那么生成后的文件名称就是: lexiw_3445645iuiu567567u5pou5675...

帝国CMS几个函数RepPostVarRepPostVar2RepPostStrRepPostStr2的用法

帝国CMS几个函数RepPostVarRepPostVar2RepPostStrRepPostStr2的用法

帝国CMS常用或者经常遇到的几个函数RepPostVar,RepPostVar2,RepPostStr,RepPostStr2的用法! (1)、数字型变量可以用(int)或intval函数处理,例子: $page=(int)$_GET['page']; 或 $page=intval($_GET['p...

帝国CMS灵动标签调用指定时间段的信息

帝国CMS灵动标签调用指定时间段的信息

帝国CMS灵动标签怎么调用指定时间段的信息呢? 1、某天发布的文章: [e:loop={'news',10,18,0,'newstime>='.to_time('2010-11-11 00:00:01').' and newstime<='.to_time('2010-11-11 23...

帝国CMS使用esub/substr截取前面(或后面)两个字符(或多个字符)

帝国CMS使用esub/substr截取前面(或后面)两个字符(或多个字符)

帝国CMS怎么用灵动标签使用esub/substr截取前面,或者截取后面两个字符或者多个字符呢? ①、帝国网站 显示是"帝国" (这是灵动标签默认的截取标签字段“esub”), [e:loop={'select * from phome_enewsclass where bclassid=0 or...

帝国CMS调用读取当天发布信息

帝国CMS调用读取当天发布信息

在帝国cms模板中,某些位置要调用当天发布的信息数量,但是不知道怎么调用实现,下面就来告诉大家怎么调用: 调用代码: <?php   $timedays=strtotime(date("Y-m-d",time()));//今天0点的时间点   $timedaye=$timedays+3600...